All Python Operators Code [PDF]

  • 0 0 0
  • Gefällt Ihnen dieses papier und der download? Sie können Ihre eigene PDF-Datei in wenigen Minuten kostenlos online veröffentlichen! Anmelden
Datei wird geladen, bitte warten...
Zitiervorschau

print("Operators in Python") print() print("Enter 2 nos (try to enter first no > second ) ") a = float(input("Enter first no:- ")) b = float(input("Enter second no:- ")) print() print("1. Arithmetic Operators:"); s = (a + b) print("1.1 Addition:- " ,s ); s = (a - b); print("1.2 Substraction:- " , s); s = (a * b) print("1.3 Multiplication:- " ,s); s = (a / b) print("1.1 Division:- " ,s); s = (a % b) print("1.4 Modulas:- " ,s); s = (a ** b) print("1.5 Exponent:- " ,s); s = (a // b) print("1.6 Floor Division:- " ,s); print() print() print() print() c = 10 d = 10 e = 15 f = 20 print("2. Relational Operators") print(" Values of variables:- ") print(" |c = 10 | d = 10 | e = 15 | f = 20|") print("2.1 Equal to :-"); if ( c == d): print("c and d are is equal") else: print ("c and d are not equal") print() print("2.2 Not Equal to '' :-"); if ( f != d): print ("f and d are not is equal") else: print ("f and d are equal") print() print("2.3 Greater than :-"); if ( f > c ): print ("f is greater than c") else: print ("f is not greater than c") print() print("2.4 Less than :-"); if ( c < f ): print ("c is lesser than f") else: print ("c is not less than f") print()

print("2.5 Less than and Equal to :-"); if ( c