>>Rules of Variable
1)A variable name must start with letter or the underscore character
2)A variable name cannot start with number
3) A variable name can only contain alpha numeric character and underscores(A-Z,0-9 and_)(No
symbols are allowed as a variable Name
4)Variable names are case sensitive(age,Age and AGE are three different variables)
5)There cant be a space among variable
Example
Legal Variable
myvar=”Himaksh”
my_var==”Himaksh”
_my_var=” Himaksh”
Myvar2=”Himaksh”
Illegal Variables
2myvar=”Himaksh”
My-var==”Himaksh” # In[26]:
Classes and Objects
Python Classes/Objects
Python is an object oriented programming language.
Almost everything in Python is an object, with its properties and methods.
A Class is like an object constructor, or a "blueprint" for creating objects.
Example
class myCar:
carName = "Honda"
carType = "civic"
car1 =myCar()
print(car1.carName)
print(car1.carType)
Output
“Honda”
“Civic”