Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Python Practice - 2

The document contains Python practice questions for Year 9 students at The Apple International School, Dubai. It includes exercises using if...else statements and while loops, covering topics such as odd/even checks, age eligibility for voting, grade calculation, and number guessing games. Each question is designed to enhance students' programming skills in Python.

Uploaded by

safakamran279
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Python Practice - 2

The document contains Python practice questions for Year 9 students at The Apple International School, Dubai. It includes exercises using if...else statements and while loops, covering topics such as odd/even checks, age eligibility for voting, grade calculation, and number guessing games. Each question is designed to enhance students' programming skills in Python.

Uploaded by

safakamran279
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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!".

You might also like