EX | Exercises |
Introduction
This unit focuses on Python’s control flow structures, particularly using if
, elif
, and else
. You’ll create small programs to practice decision-making and flow control based on given variables.
Task 1: Age Verification
Description:
Write a program that checks if a given age qualifies as being an adult.
Code Example:
age = 20 # change this value to test
if age
Task 2: Even or Odd Number
Description:
Write a program that determines if a given number is even or odd.
Code Example:
number = 7 # change this value to test
if number % 2 ...:
else:
Task 3: Grade Evaluation
Description:
Create a program that evaluates a student’s grade and assigns a classification based on a scoring scale.
Code Example:
grade = 83 # change this value to test
if grade >= 90:
print("Excellent")
elif grade >=:
print("Good")
elif grade ...:
.
.
.
else: