0% found this document useful (0 votes)
17 views2 pages

Question Set - If - Else

The document outlines a series of Python programming exercises designed to test various programming skills. Tasks include checking for leap years, determining if a rectangle is a square, calculating bonuses based on years of service, and implementing a grading system based on marks. Additional exercises involve attendance checks, age-based service location rules, dog age conversion, and various input validations.

Uploaded by

dark.rakasa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Question Set - If - Else

The document outlines a series of Python programming exercises designed to test various programming skills. Tasks include checking for leap years, determining if a rectangle is a square, calculating bonuses based on years of service, and implementing a grading system based on marks. Additional exercises involve attendance checks, age-based service location rules, dog age conversion, and various input validations.

Uploaded by

dark.rakasa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Programming Exercise 2

1. Write a program to check whether the year is leap year or not.

2. Take values of length and breadth of a rectangle from user and check if it is square or
not.

3. A company decided to give bonus of 5% to employee if his/her year of service is more


than 5 years. Ask user for their salary and year of service and print the net bonus
amount.

4. A school has following rules for grading system:


a. Below 25 - F
b. 25 to 45 - E
c. 45 to 50 - D
d. 50 to 60 - C
e. 60 to 80 - B
f. Above 80 - A
Ask user to enter marks and print the corresponding grade.

5. Write a program to print absolute value of a number entered by user.

6. A student will not be allowed to sit in exam if his/her attendance is less than 75%. Take
following input from user:
Number of classes held
Number of classes attended.
and print percentage of class attended and whether student is allowed to sit in exam or
not.

7. Ask user to enter age, gender (M or F), marital status ( Y or N ) and then using
following rules print their place of service.
If employee is female, then she will work only in urban areas.
If employee is a male and age is in between 20 to 40 then he may work in anywhere
If employee is male and age is in between 40 t0 60 then he will work in urban areas
only.
And any other input of age should print "ERROR".

8. Write a Python program to calculate a dog's age in dog's years.


Note: For the first two years, a dog year is equal to 10.5 human years. After that, each
dog year equals 4 human years.
Expected Output:
Input a dog's age in human years: 15
The dog's age in dog's years is 73
9. Write a Python program to convert month name to a number of days.
Expected Output:
Input the name of Month: February
No. of days: 28/29 days

10. Write a program to check whether a number (accepted from user) is positive or
negative.

11. Write a program that asks the number between 1 and 10. If the number is out of range
the program should display "invalid number".

12. Write a program that accepts the temperature in degree Celsius of water from user and
check whether it is boiling or not (boiling point of water in 100 degrees Celsius).

13. Write a program to check a character is vowel or not.

14. Accept the marks of English, Math and Science, Social Studies Subject from the user and
display the stream allotted according to following rules:
a. All Subjects more than 80 marks --> Science Stream
b. English >80 and Math, Science above 50 --> Commerce Stream
c. English > 80 and social studies > 80 --> Humanities

You might also like