Python Programming Worksheet-
Revision
Instructions:
Read the question below carefully and write the correct Python program to solve
the problem.
Questions:
Group 4-5
1. Create a Python program that asks the user for a number and counts how
many digits it has.
Requirements:
Ask the user for a number.
Use a loop to count the number of digits.
Display the count.
2. Create a Python program that calculates the factorial of a number using a loop.
Requirements:
Ask the user for a number.
Use a loop to calculate the factorial (n! = n × (n-1) × (n-2) × ... × 1).
Display the result.
3. Create a Python program that calculates the discount on a restaurant bill
based on the total amount spent.
Above R100: 20% discount
Between R50 - R100: 10% discount
Below R50: No discount
Group 6
1. Create a Python program that determines a person’s ticket price based
on their age.
Children (0 - 12 years): R5
Teenagers (13 - 17 years): R8
Adults (18 - 64 years): R12
Seniors (65+ years): R7
The program should ask the user for their age and display the ticket price.
2. Create a Python program that generates the multiplication table for a
number provided by the user.
Ask the user for a number.
Use a loop to print the multiplication table from 1 to 12.
Display each multiplication result.
3. Create a Python program that asks the user for a number and displays
all numbers from that number down to 1.
Ask the user for a number.
Use a loop to print numbers in descending order.