Grade VII Computer Science
Conditional statements help a program make decisions. Python checks whether a condition is True or False before executing instructions.
if condition:
statement
elif condition:
statement
else:
statement
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")
age = int(input("Enter your age: "))
if age >= 18:
print("Eligible to Vote")
else:
print("Not Eligible")
num = int(input("Enter a number: "))
if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")
password = input("Enter Password: ")
if password == "python123":
print("Access Granted")
else:
print("Wrong Password")
marks = int(input("Enter Marks: "))
if marks >= 90:
print("Grade A")
elif marks >= 75:
print("Grade B")
elif marks >= 60:
print("Grade C")
else:
print("Needs Improvement")
| Operator | Meaning |
|---|---|
| == | Equal To |
| != | Not Equal To |
| > | Greater Than |
| < | Less Than |
| >= | Greater Than or Equal To |
| <= | Less Than or Equal To |
Create any ONE application from the list below.
Design your own Python application using at least: