Variables In Python

 Variables In Python 

Variables are the temporary storage location in computer memory.

In programming, a variable is a value that can change, depending on conditions or information passed to the program.


Typically, a program consists of instructions that tell the computer what to do and data that the program uses when it is running. 


You can use any letter, the special characters"_"and every number provided you do not start with it.


White spaces and signs with special meanings in python, as "+" and"-"are not allowed. 


I usually use lowercase with words separated by underscores as necessary to improve readability.


Remember that variable names are case sensitive.


Python is dynamically typed, which means that you don,t have to declare what type each variable is.


In python, variables are a storage placeholder for texts and numbers.


It must have a name so that you are able to find it again.


The variable is always assigned with an equal sign, followed by the value of the variable.


There are some reserved words for python and can not be used as a variable name.


The variables are being referred to in the program to get the value of it.


The value of the variable can be changed later on.


Store the value 10 in a variable named too


For Example
too = 10
Store the value of too+10 in a variable named bar
bar = too+10
List Of Different Variable Types


x=123 #integer
x=123L #long interger
x=3.14 #double float
x="hello" #string
x=(0,1,2) #tuple
x=open("hello.py,r") #file


You can also assign a single value to several variables simultaneously with multiple assignments.



Variables a,b and c are assigned to the same memory location with the value of 1 a = b = c








Comments

Popular posts from this blog

HOW TO DESIGN MOON WITH HTML AND CSS SOURCE CODE