Python Variables
If we have to store something in our real life we need a container or box to store this so, the variables are nothing but simple containers to store data of different types like numbers, strings, boolean, chars, lists, tuples, ranges, etc.
Python
# Let's say you have a box to store things. # You can give the box a name, like "my_box". # Here, "my_box" is a variable. my_box = "toys" print (my_box) # Output: toys # Variables can store different types of things too. # For example, you can store numbers in a variable. my_number = 10 print (my_number) # Output: 10 # You can also combine variables together. my_message = "Hello, " + "World!" print (my_message) # Output: Hello, world! |
toys 10 Hello, World!
Rules for Python Variables:
Here are some of the rules mentioned that you must consider before naming a Python variable:
- A Python variable name must start with a letter or the underscore character.
- A Python variable name cannot start with a number.
- A Python variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).
- Variable names in Python are case-sensitive (name, Name, and NAME are three different variables).
- The reserved words (keywords) in Python cannot be used to name the variable in Python.
Python for Kids – Fun Tutorial to Learn Python Programming
Python for Kids – Python is an easy-to-understand and good-to-start programming language. In this Python tutorial for kids or beginners, you will learn Python and know why it is a perfect fit for kids to start. Whether the child is interested in building simple games, creating art, or solving puzzles, Python provides the foundation to the kids or any beginner for their coding journey.
Programming is an essential skill in today’s world because programming is used everywhere in our surroundings. And to learn programming, we have to learn a programming language and Python is the best to start with programming language. It has a simple syntax and readability is the best choice for kids to understand programming concepts. In this Python tutorial, you’ll learn all the basic concepts, installation processes, and fundamental programming concepts.
Contact Us