Simple Condition
Variable x = 10. If x is greater than 5, display "Big".
Conditions allow your program to make decisions.
if age >= 18:
print("Adult")
else:
print("Minor")
Comparison operators:
== equal (равно)
!= not equal (не равно)
> greater than (больше)
< less than (меньше)
>= greater or equal (больше или равно)
<= less or equal (меньше или равно)
IMPORTANT: Use indentation (4 spaces) after if/else!
Variable x = 10. If x is greater than 5, display "Big".
Variable score = 75. If score >= 60, display "Pass". Otherwise, display "Fail".
Variable number = 0. If number > 0, print "Positive". If number < 0, print "Negative". If number == 0, print "Zero".
Variable n = 7. Check if n is even or odd. If even, print "Even". If odd, print "Odd". Hint: Use n % 2. If n % 2 == 0, the number is even.