Practise Programs
Practise Programs
06-Nov - 24
Write a Python program for the following (Test using Thonny or Python IDLE)
1. Get a number as input from the user. The program should check if the number is positive. If
the number is positive, print "The number is positive." Otherwise, there should be no output.
2. Get the age as input from the user. If the age is 18 or older, print "You are eligible to vote."
Otherwise, print "You are not eligible to vote."
3. Get the mark as input from the user (0-100 marks). Based on the marks, the program should
print the corresponding grade:
90 and above: "Grade A*"
80 to 89: "Grade A"
70 to 79: "Grade B"
60 to 69: "Grade C"
Below 60: "Grade D"
13 - Nov - 24
SEQUENCE STATEMENTS
1. Write a program that obtains three integer numbers from the user. It will print out
the sum of those numbers.
2. Write a program to find the square and cube of a number.
3. Write a program to display your name, age and grade.
4. Write a program to find the basic pay of an employee by calculating the given
hours multiplied by the rate. (Pay=hour*rate)
5. The amount of water in a fish tank, in litres, is calculated using the formulae:
(height * width * depth) / 1000
6. The program must take the height, width and depth as input and output a suitable
message
e.g. The tank holds 221.6 litres of water.
SELECTION/CONDITIONAL STATEMENTS
7. Write a program to find the biggest of two numbers.
8. Write a program to check whether the given number is odd or even.Using for loop,
generate the first 50 even numbers
9. Write a program to check for a weather forecasting system that inputs the
temperature and outputs the suitable clothes to wear.
Temperature Clothes
LOOP/ITERATIVE STATEMENTS
10. Using for loop, print the first 20 multiples of 7
11. Using for loop, print the sum of first 20 whole numbers