COMPUTER SCIENCE (O83)
Conditional Statements (Practical)
1. Write a program to check whether a number is single digit or not
2. WAP to display the days of a week based on the value (1 to 7) given
3. WAP to check whether a number is even or odd.
4. WAP to convert the temperature in Celsius to Fahrenheit
5. WAP to check whether a triangle is equilateral or not
6. Display the grade of a students based on the total marks scored.
7. Predict the output of the following code fragment.
8. Find the error in the given code and redesign the code to get the output.
9. Predict the output of the given code:
10. Write a program that reads from user — (i) an hour between 1 to 12 and (ii) number of hours ahead. The
program should then print the time after those many hours, e.g.,
Enter hour between 1-12 : 9
How many hours ahead : 4
Time at that time would be : 1 O'clock
11. Write a program that asks the user for two numbers and prints Close if the numbers are within .001 of each other
and Not close otherwise.
12. A year is a leap year if it is divisible by 4, except that years divisible by 100 are not leap years unless they are
also divisible by 400. Write a program that asks the user for a year and prints out whether it is a leap year or not.
13. Write a short program to input a digit and print it in words.
14. Develop a program to display either the area of a square or area of a circle or area of a rectangle based on user’s
choice.
15. Check whether a person is eligible to take the covid vaccine.
16. Write a program that prompts the user to enter a number and then checks if the number is positive, negative or
zero. Print an appropriate message for each case.
17. Write a program that asks the user for their height and weight and then calculates their body mass index (BMI).
(BMI = weight (in kilograms) / height 2 (in meters).
18. Simulate the working of logical operators chosen by the user.
19. Design a simple calculator in Python.
20. Develop a program to check whether a username and password is valid.