Skip to main content

Posts

Python

                Python is an interpreted high-level general-purpose programming language. Its design philosophy emphasizes code readability with its use of significant indentation. Its language constructs as well as its object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.                     Python is dynamically-typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly, procedural), object-oriented and functional programming. It is often described as a "batteries included" language due to its comprehensive standard library.                       Guido van Rossum began working on Python in the late 1980s, as a successor to the ABC programming language, and first released it in 1991 as Python 0.9.0.[34] P...
Recent posts

#Birwise Operator

#Birwise Operator a = 50 #00110010 in binary.  b = 30 #00011110 in binary. c = 0 d = 0 e = 0 f = 0 g = 0 h = 0 #Bitwise AND c = a & b #00110010 & 00011110 = 00010010 i.e means is '18'. print ("the value of (a & b):",c) #Bitwise OR d = a | b #00110010 | 00011110 = 00111110 i.e means is '62'. print ("the value of (a | b):",d) #Bitwise Exclusive XOR e = a ^ b # 00110010 ^ 00011110 = 00101100 i.e means is '44'. print ("the value of (a ^ b):",e) #Bitwise Complement f = ~a # -(50+1)= i.e means is '-51'. print ("the value of (~a):",f) #Bitwise Complement g = ~b # -(30+1)= i.e means is '-31'. print ("the value of (~ b):",g) #Bitwise Shift Left h = a << 2 #50=00110010 << 2 :- 11001000 i.e means is '200'.            #Shift with 2 zero to left side. print ("the value of (a << 2):",h) #Bitwise Shift Right i = a >> 2 #50=00110010 >> 2 :-  001100 i.e...

#Arthmatic Operation Using Function

 #Function Arthmatic Operation #Addition def add(a ,b): #function name must start with letter or underscore. c = a + b print ("add is:",c) return c add(20, 30)  #Function Call:- You can many times call function. add (45, 45) #you can add many argumentsas you want. #subtraction def sub(a , b): c = a - b print ("sub is:",c) sub(45, 25) #45, 25 this value store in 'a' and 'b', then execute operation "45 - 25 = 20". #Division def div(a , b): c = a / b print ("div is:",c) div(100, 4) #Multiplication def multi(a , b): c = a * b print ("multi is:",c) multi(50, 5) #Modulus def mod(a , b): c = a % b print ("modulos is :",c) mod(400, 40 ) # Excute #Output #add is: 50 #add is: 90 #sub is: 20 #div is: 25 #multi is: 250 #modulos is : 0                                                           #ThE ProFessoR

#First Program in Python

 #First Program in Python print ("hellow python") #"print" use for printline #what kind of to print, just write after 'print' in ""(duble quote). # Excute #Output # hellow python                                                          #ThE ProFessoR

#For Loop

 #forloop #print 10 to 20 for i in range(10, 20):     print(i)  #OUTPUT #1 #2 #3 #4 #5 #6 #7 #8 #9 #10                                                                     #ThE ProFessoR

#Break And Continue Statement

 #Break And Continue Statement a = 10 while(a <= 20):#(a=10 <= 20) the condition is True; then excute conditional code. if(a == 15):#a==15)when... #block of code to be executed if the condition is True a = a + 1 print "in if statement of a is:",a continue #Continue:-when the loop iterate for the first time the value of i=10, the if statement result will be false, so the else condition 2 is implemented.   #loop iterates again now i=15; if condition result will be 'True' and the code stop in between and strat new iterate unitl the end condition met.  #Break :- when the loop iterates for first time, the value of i=10, the if statement result will be false, so the else condition is executed. #loop iterates again now i=15; if condition result will be 'True' and loop breaks. print "the value of a is",a a = a + 1 #a++ for this condition 'a <= 20'. value increase upto 20. # Execute #OUTPUT #//Continu...

#Relation(Comparison) Operator

 #Relation(Comparison) Operator a = 21 b = 10 #Equal To print  "a==b is",a==b;  #(a=21 == b=10) is False; Therefore a is not equal to b.               #the two given values are equal to each other then result will be True, Otherwise it returns False. #Not Equal to  print  "a!=b is",a!=b; #Grater Than print  "a>b is",a>b; #(a=21 > b=10) is True; Therefore a is grater than b.                                  #the first value is grater than the second value then result will be True, Otherwise it returns False. #Less Than print  "a<b is",a<b; #(a=21 < b=10) is False; Therefore a is not less than b.                                #the first value is less than the second value then result will be True, Otherwise it returns False. #Grater ...

#Logical Operator

 #Logical Operator a = 50 b = 30 #Logical AND if(not((a > b) and (a != b))): # !(a=50 > b=30) is False && (a=50 != b=30) is True; Therefore this statement is False.                                # when both statement are True then result will be True.                                # '!'not is True statement consider False and False statement consider to True. print "this statement is true" else: print "this statement is false" #Logical OR if ((a < b) or (a != b)): #(a=50 < b=30) is False || (a=50 != b=30) is True; therefore this statement is True.                           #if one(or both) statement is True then result will be True, Otherwise it returns False. print "this statement is true" else: print "this statement is false" # E...

#Assignment Operators

 #Assignment Operators a = 31 c = 9 #Add AND c += a # c = c + a; 9 + 31 = 40 print ("the addition is :",c) #Subtract AND c -= a # c = c - a; 40 - 31 = 9 print ("the substraction is :",c) #Multiply AND c *= a # c = c * a; 9 * 31 = 279 print ("the multiply is :",c) #Division AND c /= a # c = c /a; 279/31 = 9.0 print ("the division is :",c) #Mod AND c %= a # c = c % a; 9.0 % 31  = 9.0 print ("the modulos is :",c) # Execute #Output #the addition is : 40 #the substraction is : 9 #the multiply is : 279 #the division is : 9.0 #the modulos is : 9.0                                                       #ThE ProFessoR

#Arthmatic Operator

#Arthmatic Operator a = 21  b = 10 #Addition c=a+b print("Line 1 : the value of c :",c) #'print' use for print line. #Subtraction c=a-b print("Line 2 : the value of c :",c) #Multiplication c=a*b print("Line 3 : the value of c :",c) #Division c=a/b print("Line 4 : the value of c :",c) #Modulus c=a%b print("Line 5 : the value of c :",c) Execute # Output # Line 1 : the value of c : 31 # Line 2 : the value of c : 11 # Line 3 : the value of c : 210 # Line 4 : the value of c : 2.1 # Line 5 : the value of c : 1                                                   #ThE ProFessoR