learnpython24-(Python Variables, Constants and Literals)
Python Variables, Constants and Literals In this tutorial, you will learn about Python variables, constants, literals and their use cases. Python Variables A variable is a named location used to store data in the memory. It is helpful to think of variables as a container that holds data that can be changed later in the program. For example, number = 10 Here, we have created a variable named number . We have assigned the value 10 to the variable. You can think of variables as a bag to store books in it and that book can be replaced at any time. number = 10 number = 1.1 Initially, the value of number was 10 . Later, it was changed to 1.1 . Note : In Python, we don't actually assign values to the variables. Instead, Python gives the reference of the object(value) to the variable. Assigning values to Variables in Python As you can see from the above example, you can use the assignment operator = to assign a value to a variable...