0% found this document useful (0 votes)
0 views

List of if...else programming exercises

The document provides a list of programming exercises focused on using if...else statements in Python. It includes tasks such as finding maximum numbers, checking for positive or negative values, determining leap years, and calculating grades based on percentages. Each exercise is designed to enhance programming skills through practical applications.

Uploaded by

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

List of if...else programming exercises

The document provides a list of programming exercises focused on using if...else statements in Python. It includes tasks such as finding maximum numbers, checking for positive or negative values, determining leap years, and calculating grades based on percentages. Each exercise is designed to enhance programming skills through practical applications.

Uploaded by

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

List of if...

else programming exercises

1. Write a python program to find maximum between two numbers.

2. Write a python program to find maximum between three numbers.

m
3. Write a python program to check whether a number is negative, positive or zero.

co
4. Write a python program to check whether a number is divisible by 5 and 11 or not.

a.
5. Write a python program to check whether a number is even or odd.

ity
6. Write a python program to check whether a year is leap year or not.

ad
7. Write a python program to check whether a character is alphabet or not.
ne
8. Write a python program to input any alphabet and check whether it is vowel or consonant.

9. Write a python program to input any character and check whether it is alphabet, digit or
zo

special character.
y

10. Write a python program to check whether a character is uppercase or lowercase alphabet.
ud

11. Write a python program to input week number and print week day.
t
.s

12. Write a python program to input month number and print number of days in that month.
w

13. Write a python program to count total number of notes in given amount.
w

14. Write a python program to input angles of a triangle and check whether triangle is valid
w

or not.

15. Write a python program to input all sides of a triangle and check whether triangle is valid
or not.
16. Write a python program to check whether the triangle is equilateral, isosceles or scalene
triangle.

17. Write a python program to find all roots of a quadratic equation.

18. Write a python program to calculate profit or loss.

m
19. Write a python program to input marks of five subjects Physics, Chemistry, Biology,
Mathematics and Computer. Calculate percentage and grade according to following:

co
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C

a.
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E

ity
Percentage < 40% : Grade F

20. Write a python program to input basic salary of an employee and calculate its Gross salary
according
Basic
Basic
Salary
Salary
<=
<=
10000
20000
:
:
to
HRA
HRA
ad =
=
20%,
25%,
DA
DA
=
=
following:
80%
90%
ne
Basic Salary > 20000 : HRA = 30%, DA = 95%
zo

21. Write a python program to input electricity unit charges and calculate total electricity bill
according to the given condition:
For first 50 units Rs. 0.50/unit
y

For next 100 units Rs. 0.75/unit


For next 100 units Rs. 1.20/unit
ud

For unit above 250 Rs. 1.50/unit


An additional surcharge of 20% is added to the bill
t
.s
w
w
w

You might also like