IF-ELSE In Python
Code Example 1: # Find the largest among 2 numbers x, y = 2, 1 if x>y: print("Big is : ", x) else: print("Big is : ", y) Example 2: print("--------------------------") # Find the largest among 3 numbers a, b, c = 6, 4, 7 if a>=b and a>=c: print("A") elif b>=a and b>=c: print("B") elif c>=b and c>=a: print("C") Example 3: print("--------------------------") a, b, c = 8, 4, 7 if a>b: if a>c: print("a is max") else: print("c is max") elif b>a: if b>c: print("b is max") else: print("c is max") else: print("c is max") Example 4: x, y = 10, 20 print(x) if x>y else print(y) Screenshot : Enjoy Edge-cutting Technology 😉 Quiz Level 1 Quiz Level 2 Request Me