Python Question GCSE
Python Question GCSE
CHECK
KNOWLEDGE CHECK 1
Write a python program that calculates the Area of a Rectangle
- ask the user for the length
- ask the user for the width of a rectangle
- calculates the area
- output the area
Do you need help? Here is the start of the if statement (but you need to fugure
out the line before this!):
if number > 0:
YOUR ANSWER
KNOWLEDGE CHECK 4
Write a python program that converts Celsius to Fahrenheit
- ask the user for the Celsius
- calculates the Fahrenheit using the formula below
Fahrenheit=(Celsius×9/5)+32
- output the Fahrenheit
• Write a python program that takes an integer n and displays all prime
numbers up to n.
YOUR ANSWER
KNOWLEDGE CHECK 10
- E.g. If the user entered 5, the program would display, 5, 10, 15 and 20
- If the user entered 4, the program would display, 4, 8, 12, 16
YOUR ANSWER
KNOWLEDGE CHECK 11
Write a program that asks the user to enter five positive numbers, one at a time.
The program should validate that each entry is a positive number.
After all five valid numbers are entered, calculate and display the average.
YOUR ANSWER
KNOWLEDGE CHECK 12
Write a program that asks the user to enter a date in the format
DD/MM/YYYY.
•The day should be within the valid range for the given month (e.g., 1-31 for
January, 1-30 for April, etc.).
•Consider leap years (a year is a leap year if it’s divisible by 4, but not by 100,
except when it’s divisible by 400).
•If the date is invalid, display an error message and prompt the user to enter it
again.
YOUR ANSWER