Grade 7 · Computer Science

Python Practice Worksheet

Topic: Decision Making using if-elif-else

Instructions

Read each programming question carefully and write your Python program in IDLE.

Use if-elif-else wherever required. Use suitable variable names, convert input values with int() or float() when necessary, and test your program with different values.

Work on the questions assigned by your teacher. The questions are grouped by challenge level.

Developing Confidence

Q1. Performance Grade

Write a Python program to accept a student's marks and display the corresponding grade.

MarksGrade
90 and aboveA
75–89B
60–74C
40–59D
Below 40Needs Improvement

Use if-elif-else to display the appropriate grade.

Q2. Temperature Advisory

Write a Python program to accept the temperature in Celsius and display the following message:

Applying and Analysing

Q3. UAE Shipping Charges

An online shopping company calculates delivery charges based on the order amount.

Order amount (AED)Delivery charge
300 and aboveFree
200–299AED 5
100–199AED 10
Below 100AED 15

Write a Python program to accept the order amount and display the delivery charge.

Q4. Electricity Consumption Category

A household's monthly electricity consumption is classified as follows:

Write a Python program to accept the number of units consumed and display the appropriate category.

Q5. School Competition Selection

A school selects students for a programming competition based on their marks.

Write a Python program to accept a student's marks and display the selection status.

Higher Challenge

Q6. Smart Shopping Discount Calculator

A shopping store offers discounts based on the total purchase amount.

Purchase amount (AED)Discount
500 and above20%
300–49915%
150–29910%
Below 150No discount

Write a Python program to:

  1. Accept the total purchase amount.
  2. Determine the discount percentage using if-elif-else.
  3. Calculate the discount amount.
  4. Calculate and display the final amount payable.

Q7. Water Conservation Alert System

A smart water-monitoring system classifies household water consumption based on monthly usage and the number of people living in the household.

Use the following rules in the given order:

  1. If consumption is above 1,000 litres, display Critical Consumption.
  2. Otherwise, if consumption is above 700 litres and the household has more than 5 people, display High Consumption.
  3. Otherwise, if consumption is above 500 litres, display Moderate Consumption.
  4. Otherwise, display Responsible Consumption.

Write a Python program to accept monthly water consumption and the number of household members, then display the appropriate alert.

Q8. Digital Wallet Transaction System

A digital wallet classifies a transaction based on the amount entered.

Write a Python program to accept a transaction amount and display the appropriate message.

Extension Challenge

Q9. Smart Student Achievement System

A school awards achievement levels based on a student's marks and attendance.

ConditionAchievement
Marks ≥ 90 AND attendance ≥ 95Outstanding
Marks ≥ 80 AND attendance ≥ 90Excellent
Marks ≥ 70 AND attendance ≥ 85Very Good
Marks ≥ 60Good
OtherwiseNeeds Improvement

Write a Python program to accept marks and attendance percentage and display the achievement level.

Use if-elif-else and logical operators where required.