The Apple InTernATIonAl School, DubAI
Year – 9
Computing
Python Practice Questions
Questions Using if...else Statements:
1. Odd or Even Check
Write a program that takes an integer input from the user and checks if it is odd or even.
2. Positive, Negative, or Zero
Take a number from the user and print whether the number is positive, negative, or
zero.
3. Age Eligibility for Voting
Ask the user to enter their age. If the age is 18 or above, print "Eligible to vote",
otherwise print "Not eligible to vote".
4. Largest of Two Numbers
Take two numbers as input and print the largest one. If both are equal, print "Both
numbers are equal".
5. Grade Calculator
Accept a student's marks (0-100) and print their grade based on the following:
o 90 and above → A
o 80-89 → B
o 70-79 → C
o 60-69 → D
o Below 60 → F
6. Leap Year Checker
Write a program to check whether a given year is a leap year or not. (A year is a leap year
if it is divisible by 4 but not by 100, except when it is divisible by 400.)
Questions Using while Loops:
1. Print Numbers from 1 to 10
Write a program to print numbers from 1 to 10 using a while loop.
2. Sum of Natural Numbers
Take an integer input n from the user and find the sum of the first n natural numbers
using a while loop.
3. Multiplication Table
Ask the user for a number and print its multiplication table up to 10 using a while loop.
4. Count Digits of a Number
Take a positive integer as input and count how many digits it has using a while loop.
5. Reverse a Number
Write a program that takes a number and reverses it (e.g., input: 1234, output: 4321).
6. Guess the Number Game
Create a number guessing game where the program randomly selects a number
between 1 and 100, and the user keeps guessing until they find the correct number.
After each guess, provide hints like "Too high!" or "Too low!".