Python Notes
Python Notes
>>>Immidiate prompt
type()- type() return class information of object.
Python Operator
1. Arithmetic Operator
+ - * /(division that return float value)
//(division that return int value floor value)
Exponential or Power 2**3
% Modulos (Remainder return)
2. Assignment Operator
= value are assign right to left
i=10
+=
i+=1 or i=i+1
-=
*=
/=
//=
=
%=
3. Comparison Operator(it return True/False)
== equality operator
!= not equal to
> greater than
< less than
<= less than equal to
>= greater than equal to
4. Logical Operator
and (it use with 2 condition and return true if both condition true)
or (either or any one the condition are true then it return true)
not (reverse if True then return False otherwise it return Ture)
5. Identity Operator(True/False)
is
is not
6. Membership Operator(True/False)
in
not in
7. Bitwise Operator
& AND
! Or
^ XOR
~ NOT
<< left shift
>> right shift
Decimal Binary
0 00000000
1 00000001
2 00000010
3 00000011
4 00000100
5 00000101
6 00000110
7 00000111
8 00001000
9 00001001
10 00001010
11 00001011
i=10 00001010
i<<2 00101000 40
i>>2 00000010 2
-----------------------------------------------------------------------------------
---------------
day-2
1.rint("constant",variable)
2.rint bydefault use \n it maens next line
3.rint('welcome',end='')
4.ype()
5.vm(python virtual machine)
6.source code(.py)--->python interpreter--->bytecode--->
7.ompile(compiler)--->Native code
{ no curly braces
}
i=0;
8.range()
range(start,stop,step)
* start ,step are optional(because start by default 0 and step default +1)
* stop always work on n-1(if stop value is 10 then it work till 9)
9.Loop
looping statement in python only 2
for(basket loop)'
while(pre loop)
for loop
else is optional but if you mention else then it must execute when basket are
empty.
input()-input method accept default string value.
But whenever you need you can convert these string by using
int(),float(),bool(),complex()etc.
enter name and five subject marks and print name total marks and percentage
'''
1
121
12321
1234321
123454321