## Python variables in Python Programming

During this lecture, we are going to discuss the Python variables with more details. Are you want to know about Variable then you can also read my previous lecture. We have discussed in the previous lecture about â€śPython print variable and Python data types in Python 3â€ť. In this lecture, you are going to learn how to use the correct data type of variables to compute the correct result in python programming. If we will use the wrong Data type then computed result will be wrong.

### How to use Correct Python variables in Python Programming?

#### Example of Data Types

Like we initialize a Python Variables variable in string Datatype.

```speed_of_light= ("23465394")
print (speed_of_light)Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â  #speed of light in meter per second
OUTPUT: 23465394```

We will convert it in meter per minute.

If we can multiply direct this variable by (speed_of_light * 60). It will be wrong because string keyword will repeat 60 times as given below.

```light = (speed_of light*60)Ă‚Â  Ă‚Â  Ă‚Â
print (light)
Output: 23465394234653942346539423465394234653942346539423465394234653942346539423465394... repeat 60 times
that is wrong output because we used wrong Data Type. if we can multiply any number by string then string alphabets will be repeated.```

#### Now we will use the correct Python Variables data type

we will convert it in meter per minute by multiplies 60 using correct Python variableâ€™s Data Type.

```speed_of_light =Ă‚Â  23465394
print (speed_of_light)Ă‚Â                 # also speed of light in meter per second
light = (speed_of_light*60)            # it is correct because it is possible to multiply integer with integer
print (light)
Output:
23465394
1407923640```

Correct Output Ă˘Ë†Ĺˇ because we have to use an integer data type that is correct according to the program logic. ThatĂ˘â‚¬â„˘s why itĂ˘â‚¬â„˘s much important to know about it data types and itâ€™s used in the program.

### How to use Multiple Python Variables with the Same Name in Python Programming?

We can useĂ‚Â multiple variables with the same name in a program.

Example:

```minute = 6Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â # Declare a minute variable
minute = (minute+1)Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â  #Now minuteĂ˘â‚¬â„˘s variable value will be 7
minute =(minute*2)Ă‚Â Ă‚Â  Ă‚Â Ă‚Â Ă‚Â Ă‚Â Ă‚Â #Now minuteĂ˘â‚¬â„˘s variable value will be 14
print (minute)
Output: 14```

Note: Compiler start computes the value from topĂ‚Â to bottom and Print those value which is given at the end before print statements. As you can see in the above example. I hope you are understanding the concept of value at each given line. In this lecture, we learn about Ă˘â‚¬Ĺ“Python variables in Python Programming Ă˘â‚¬Âť.

[mks_pullquote align=â€ťleftâ€ť width=â€ť848â€ł size=â€ť15â€ł bg_color=â€ť#8ed65câ€ť txt_color=â€ť#ffffffâ€ť]I hope this series will be very helpful to understand every concept of Python Programming. You can also learn about What is WordPress?, the Difference between Web Design and Web Development and many another programming languages.Ă‚Â Special for the beginner who wants to learn from scratch. It is a convenience for all the students to make notes. You can also watchĂ‚Â the videoĂ‚Â lecture, practice through the written article of every Specific lecture. If you have any queries about any lecture please discuss in the comments section. Donâ€™t forget to give your feedback. Thank you!.[/mks_pullquote]

Â

Categorized in: