In Python, a variable is a way to store data so you can use it later. Variables can hold different types of data:
x = 5
x = 3.5
name = “soda”
You can combine (concatenate) strings using the + operator. Here’s an example:
greeting = "Hello"
name = "Clarissa"
full_greeting = greeting + " " + name # Combining strings with a space in between
print(full_greeting)
Python supports basic arithmetic operations like addition (+), subtraction (-
), multiplication (*), division (/), and exponentiation (**).
Question 1:
What are the three main types of data that variables can hold in Python? Give an example for each type.