Programming for Beginners

Programming for Beginners

Understanding Variables and Data Types

In programming, variables are containers that store information. Imagine a box where you can store a value. Each variable has a unique name to reference it.

Data types determine what type of information a variable can store. Here are some common types:

Integers (int): Whole numbers, such as 1, 5. -3.

Floats: Decimal numbers, such as 3.14, -0.5.

Strings (str): Sequences of characters, such as "Hello, world!"

Boolean (bool): They represent truth values, True or False:

Example combining variables and data types:

In this example, we create variables with different types of data and use them to store information such as name, age, height, and whether someone is a student or not. Then, we print that information to the console. This is a basic concept, but it is essential to understanding how to store and manipulate data in programming.