Python keywords :-
a=10
b=5
c=a+b
b=10
c=a+b
Total_marks = Physics+Math+English+\
History+Economy +\
Chemistry+Hindi+Civics+\
biology
Total_marks =[Physics+Math+English+
- Python has 33 keywords that are given below.
- All keyword in lowercase except(False,None&True)
Note ->
- Comments begin with #
Eg. #sum of two numbers
p=a+b
OR
q=a+b #sum of two numbers
- Multi-line comments should be written in a pair of ''' or """
Eg.
''' Name = Ram
Age = 30
Education= B.Tech
Occupation=Student'''
OR
Eg.
"""Name = sita
Age = 20
Education= B.Tech
Occupation=Student"""
- In python,Indentation is more important. You have to use it very carefully.Don't use it casually.Following code will be reported as error.
a=10
b=5
c=a+b
- Following python code will be correct manner as given below:-
Eg.
a=5b=10
c=a+b
- We can use \ (backslash) in python codes ,when we want to write multi-line with each line except the last ending with a \ .
History+Economy +\
Chemistry+Hindi+Civics+\
biology
- If we are using following brackets [ ] , { }and ( ). we don't need \ (backslash) as shown below.
Eg.
Total_marks =[Physics+Math+English+
History+Economy +
Chemistry+Hindi+Civics+
biology]
Chemistry+Hindi+Civics+
biology]
- In python programming ,there is no need to define type of a variable .
Eg.
a=5
b=20
c=a=b
print(c)
- Simple Variable declaration and assignment in python language.
Eg.
a=12
b=17
name='Ram'
- Multiple Variable assignment:- We can use multiple variable assignment in python.We can use ; as statement separation.
Eg.
a=10;b=30;c=40;name='Ram'
OR
a,b,c,name=10,30,40,'Ram'
#If more variable has same value:
p=q=r=20
Python Types:-
There are some built-in types of python as given below:-
There are some built-in types of python as given below:-
- Basic Types:- int,float,complex,bool,bytes,string .
- Container types:- list,tuple,set,dict
- User-defined :- class
- Numbers:-
int -> 156(decimal),0432 (octal),0x4A3(hexadecimal)
float -> 314.1528(decimal),3.141528e2 (octal), 3.141528E2(hexadecimal)
complex -> 5+4j , 3+10j # contains real and imaginary part
Watch Lecture 5 Complete Video:-
Watch Lecture 5 Complete Video:-
0 comments:
Post a Comment