In programming, we need to store information. We use variables for this, which are like labeled jars. In a kitchen in Andhra, you have jars for 'Rice', 'Lentils', and 'Chilli Powder'. In programming, we have variables for names, ages, and so on.
Story: Let's create a variable to store a city name. The variable is the "jar," and the city name is what's inside.
The Code: city = "Vijayawada"
Story: "Vijayawada" is text. In programming, text is called a String. It's always wrapped in quotes.
Analogy: The name written on the jar's label.
Story: Let's store the number of mangoes from a farm. Numbers don't need quotes.
The Code: mangoes = 150
Story: Now you can use the jar's label (the variable name) to get what's inside.
The Code: print("I live in", city) will show "I live in Vijayawada".
# Storing text (a String)
city = "Vijayawada"
print("The city is:", city)
# Storing a whole number (an Integer)
mangoes = 150
print("Number of mangoes:", mangoes)
If you have the code name = "Ramesh", what is the variable?