List of if...else programming exercises
List of if...else programming exercises
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.
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