I F...ELSE, WHILE & FOR LOOPS If...else a = 200 b = 100 if b > a: print("b is greater than a") elif a == b: print("a and b are equal") else: print("a is greater than b") a is greater than b if a > b: print("a is greater than b") a is greater than b print("A") if a > b else print("B") A a = 200 b = 201 print("A") if a > b else print("=") if a == b else print("B is greater than A") B is greater than A if a > 100: print("A is above 100") if b > 300: print("B is above 300!") else: print("B is not above 300!") A is above 100 B is not above 300! if a > b: pass Having an empty if statement like this, would raise an error without the pass statement While Loops i = 1 while i < 6: print(i) if i == 3: break ...
FOR BEGINNER PROGRAMMER & COMPUTER SCIENCE STUDENTS