Conditional Statements - Assignments
A company decided to give bonus of 5% to employees if his/her salary is less than 75000. Ask user for their salary and calculate his bonus and this month salary.
Enter your salary : 85000
Output :
Your Bonus : 0
Your This Month Salary : 85000
2. A student will not be allowed to sit in exam if his attendance is less than 75 percent.Ask how many classes were held and how many classes were attended and calculate his percentage.
Number of classes held : 100
Number of classes attended : 50
Attendance Percentage : 50.0%
You are not allowed to sit in exam.
3.Write a program to check whether a person is eligible for voting or not.(voting age >=18)
Enter your age : 19
You are allowed to vote
4.Write a program to check whether a number entered by user is even or odd.
Enter the number : 17
17 is odd
5.Write a program to calculate the electricity bill (accept number of unit from user) according to the following criteria :
First 100 Units
No charge
Next 100 Units
5 Rs Per Unit
After 200 Units
10 Rs Per Unit
6.Write a program to accept percentage from the user and display the grade according to the following criteria:
>=90
A
>=80 and <90
B
>=60 and <80
C
<60
D
Enter the marks : 87
B
7.Accept the age, sex (‘M’, ‘F’), number of days and display the wages accordingly.
>=18 and <30
M
700
F
750
>=30 and <=40
M
800
F
850
If age does not fall in any range then display the following message: “Enter appropriate age”
8.Accept the number of days from the user and calculate the charge for library according to following :
Till five days
2
Six to Ten days
3
Eleven to Fifteen days
4
After Fifteen days
5
Enter the number of days : 16
Library Fees : 50
9.Write a program to check if a year is leap year or not. If a year is divisible by 4 then it is leap year but if the year is century year like 2000, 1900, 2100 then it must be divisible by 400.
Enter the year : 2000
Leap Year
You work in a company and you are given customers number, But many customers filled wrong data, so you need to check if the number given by customer is right or not.
Phone Number should match following Criteria :
Only numbers , spaces and - are allowed though (so few customers wrote their number with spaces.)
12 digits only.
+ is allowed , though only at beginning of the number.
If it matches all the three criterias , Print it is a valid number else Print it is not a valid number with the reason why ?
number = '+91 - 765 - 181 - 1162'
Valid Number
You need to set a pin for your computer but there are certain rules that your pin should have to be a valid pin for your machine.
1.It should have only numbers
2.It should have any of these three symbols [&@#]
3.It should have more than 10 characters.
Create a Sign up and login portal where take values like userid and password from user and sign up and then ask him to login. if credetials match print Welcome to python session else print incorrect details.
Additioal : print reason why he could not login (was user id wrong or password wrong ? )
Given two numbers, determine which one is larger.
Write a program to find the largest of three numbers.
Write a program to check whether a given string is a palindrome or not.
Write a program to check whether a given character is a vowel or a consonant.
Write a program to check whether a given string is a valid email address (i.e., it contains exactly one "@" symbol and at least one "." after the "@").
Last updated