# variables Variables are used to store data. Each variable has a name and holds a value. Think of it like a box: slap on a label, and it can store stuff. šŸ“¦ The variable name can consist of letters, numbers, and the _ underscore. These are all valid variable names and values: ```python name = 'Joe' name2 = 'Joseph' user_id = 26789437849 progress = 0.75 xp = 60 verified = True ``` We can also change the value of a variable or print it out: ```python xp = 70 xp = 80 print(xp) # Output: 80 ``` Here, we are assigning the number value 70 to the variable xp. Then, we are reassigning the number value 80 to the same variable. And printing it out. # data types ## integer An integer, or int, is a whole number. It has no decimal point and contains the number 0, positive and negative counting numbers. ```python year = 2025 age = 32 ``` ## float A floating-point number, or a float, is a decimal number. It can be used to represent fractions or precise measurements. ```python pi = 3.14159 meal_cost = 12.99 ``` ## string A string, or str, is used for storing text. Strings are wrapped in double quotes " " or single quotes ' '. ```python message = "good nite" username = '@snoopdogg' ``` ## boolean A Boolean data type, or bool, stores a value that can only be either true or false. ```python late_to_class = False cranky = True ``` # operators `x + y` | Sum of two numbers `x - y` | Difference of two numbers `x * y` | Product of two numbers `x / y` | Quotient of two numbers `x // y` | Quotient of two numbers, returned as an integer `x % y` | x "modulo" y: The remainder of x / y for positive x, y `x ** y` | x raised to the power y `-x` | A negated number `abs(x)` | The absolute value of a number `x == y` | Check if two numbers have the same value `x != y` | Check if two numbers have different values `x > y` | Check if x is greater than y `x >= y` | Check if x is greater than or equal to y `x < y` | Check if x is less than y `x <= y` | Check if x is less than or equal to y ## using operators Operators can be used to alter numbers (and sometimes strings). ```python print(2 + 3) # Output: 5 ``` ```python print("Hello " + "World") # Output: Hello World ``` ## operators with variables Operators can also be used with variables. That can help you keep track of what you're doing. ```python pizza = 2.99 coke = 0.99 total = pizza + coke tip = total * 0.2 print(tip) # Output: 0.796 ``` # instructions Complete each of the following challenges using variables, operators, and `print()`. **Challenge 1** > Create a program that determines the sales tax for a given price. It should `print()` the sales tax and the total including the tax. **Challenge 2** > Create a program that determines the tip you should give at a restaurant. It should start with the total (dollar amount), calculate taxes and a 20% tip, and `print()` the original total, tax, tip, and grand total. **Challenge 3** > Create a program that converts a number from Fahrenheit (F) to Celsius (C). > > $ > C = \frac{5}{9} \cdot (F - 32) > $ > > `print()` the result.