1. Write a python program to verify a number is even or odd, if it is even then verify whether it is divisible by 10 or not.
a = int(input("Enter any Number ="))
if a % 2 == 1:
print("Odd Number")
else:
##Modal1
if a % 10 == 0:
print("Even Number. Divisible by 10")
else:
print("Even Number. Not divisible by 10")
##Modal 2
print("Even Number divisible by 10") if (a % 10) == 0 else print("Even Number not divisible by 10")


2. Write a python program to verify a number is even or odd, if it is even then verify whether it is divisible by 10 or not. If it is even then verify whether it is equal to 100 or not.
a = int(input("Enter a Number"))
if a % 2 == 0:
if a % 10 == 0:
if a == 100:
print("Even number ,divisible by 10 and equal to 100.")
else:
print("Even number,divisible by 10,but not equal to 100.")
else:
print("Even number not divisible by 10.")
else:
print("Odd Number")


3. Develop python code to verify a student is allowed for exams or not based on his attendance. Inputs are classed held and classes attended. The criteria is if attendance is >=75% then only he/she is allowed, however an exception of medical issues then 10% will be considered.
a = int(input("Enter Number of Classes held : "))
b = int(input("Enter Number of Classes attended : "))
c = input("Medical Issues : ")
d = (b/a)*100 ## for calculating percentage.
if c == "Yes" or c == "yes" or c == "s":
if d >= 65:
print("You are allowed.")
else:
print("You are not allowed.")
elif d >= 75:
print("You are allowed.")
else:
print("You are not allowed.")


4. Develop python code to find the smallest among 3 numbers.
a = int(input("Enter a Number :"))
b = int(input("Enter a Number :"))
c = int(input("Enter a Number :"))
if a <= b and a <= c:
print("The smallest number is :",a)
elif b <= a and b <= c:
print("The smallest number is :",b)
else:
print("The smallest number is :",c)


5. Write python code to verify a leap year or not( Your program must verify for century , years also).
a = int(input("Enter Centuries :"))
b = int(input("Enter Years :"))
a = a*100 ## convert century to years
c = a+b
if c % 4 == 0:
print("Is a Leap year")
else:
print("Not a Leap year")


6. Write python code to read any string puc/engg. If user enters any other string then display “please enter valid branch”, If the user enter puc then ask to enter first 3 characters of id, based on id print whether that id belong to p1 or p2, if user enters engg then ask the user to enter first 3 characters of id and determine whether that id belong to e1/e2/e3/e4.
a = input("Enter Your branch : \'puc\' or \'engg\'")
if a == "puc":
b = input("Please enter first 3 characters of your ID :")
if b == "s21" or b == "S21":
print("Your belongs to P1")
elif b == "s20" or b == "S20":
print("Your belongs to P2")
else:
print("Please enter valid input")
elif a == "engg":
b = input("Please enter first 3 characters of your ID :")
if b == "s19" or b == "S19":
print("Your belongs to E1")
elif b == "s18" or b == "S18":
print("Your belongs to E2")
elif b == "s17" or b == "S17":
print("Your belongs to E3")
elif b == "s16" or b == "S16":
print("Your belongs to E4")
else:
print("Please enter valid input")
else:
print("Please enter valid branch")


7. Write a python program to verify a character entered by the user is a alphabet or number or special character. If it is a alphabet then verify whether it is a small alphabet or capital alphabet.
a = input("Enter a character :",)
b = len(a)
if b == 1:
if chr(97) <= a <= chr(122):
print("Small Alphabet")
elif chr(65) <= a <= chr(90):
print("Capital Alphabet")
elif chr(49) <= a <= chr(57):
print("Number")
elif a == " ":
print("Invalid Input")
else:
print("Special Character")
else:
print("Please enter only one character")


8. Write a python program to verify a number is above 10 or below 10 or equal to ten, if it is above 10 then verify whether it is equal to 15 or not. If the number is below 10 then find whether it is positive or negative number.
a = int(input("Enter any Number :"))
if a < 10:
if a < 0:
print("Below 10 and Negative Number")
else:
print("Below 10 and Positive Number")
elif a > 10:
if a == 15:
print("Above 10 and Equal to 15")
else:
print("Above 10 and Not Equal to 15")
else:
print("Equal to 10")


9. Find the second largest among 3 numbers.
a = int(input("Enter a Number"))
b = int(input("Enter a Number"))
c = int(input("Enter a Number"))
if a < b and a < c:
if b < c:
print(b,"is the second largest number")
else:
print(c,"is the second largest number")
elif b < a and b < c:
if a < c:
print(a,"is the second largest number")
else:
print(c,"is the second largest number")
else:
if a < b:
print(a,"is the second largest number")
else:
print(b,"is the second largest number")


10. Read any three subject a6s of a student and verify whether he/she is pass/not/first class/second class. Conditions are: each subject must be >=15, if overall average is >65 then first class, if overall average is >55 the second class.
a = int(input("Enter your subject1 a6s :"))
b = int(input("Enter your subject2 a6s :"))
c = int(input("Enter your subject3 a6s :"))
if a >= 15 and b >= 15 and c >= 15:
if a+b+c >= 65:
print("You got First class.")
elif a+b+c > 55:
print("You got Second class.")
else:
print("Your Passed.")
else:
print("Your Failed.")


11. Write a python program to verify a person okay or not for fitness test. Conditions: Age must be 18-50 and weight is 50 to 70 then okay. If age is below 18 and above 50 then not okay.
a = int(input("Enter your age in years :"))
b = int(input("Enter your weight in KG :"))
if a >= 18 and a <= 50 and b >= 50 and b <= 70:
print("Your Okay for the fitness test.")
else:
print("Not Okay for the fitness test.")


12. Write python code to calculate concession on ticket fares. If any person age is above 50 then concession is 20%. if person age is 40-50 then concession is 10%. if male in between 40-50 concession is only 5%.for any person age below 40 then concession is 5%.if the person is female and below 40 then concession is 3%.
a = int(input("Enter your Age :"))
b = input("Enter your Gender(male or female):")
if a > 50:
print("You got 20% concession.")
elif a >= 40 and a <= 50:
if b == "female":
print("You got 10% concession.")
elif b == "male":
print("You got 5% concesssion.")
else:
print("Invalid input.")
elif a < 40:
if b == "female":
print("You got 3% concession.")
else:
print("You got 5% concession.")
else:
print("Invalid input.")


13. Write a python program to calculate power bills based on units consumption.
If bill is 0-50 units then per unit cost is 2 Rs (2.50 Rs for urban areas).
if bill is 51-100 units then per unit cost is 3Rs (3.25Rs for urban areas).
if bill is 100 and above then per unit cost is 4Rs ( 4.50 for urban).
a = int(input("Enter current bill units :"))
b = input("Enter type of area(urban or rural) :")
if a > 0 and a <= 50:
if b == "urban":
print("Your current bill is ",float(a*2.5))
else:
print("Your current bill is",float(a*2))
elif a > 50 and a < 100:
if b == "urban":
print("Your current bill is ",float(a*3.25))
else:
print("Your current bill is",float(a*3))
elif a >= 100:
if b == "urban":
print("Your current bill is ",float(a*4.5))
else:
print("Your current bill is",float(a*4))
else:
print("Invalid input.")


14. Write a program to calculate the total salary of the employee. Take employee name, experience, gender and basic salary as input and calculate total salary based on following conditions.
if gender is female, if experience>30 years DA=40% of basic salary HRA=25% of basic salary.
if experience>20 years,DA=30% of basic salary HRA=15% of basic salary.
if experience<=20 years DA=15% of basic salary HRA=10% of basic salary.
if gender is male, if experience>30 years DA=35% of basic salary HRA=2% of basic salary.
if experience>20 years DA=25% of basic salary HRA=10% of basic salary.
if experience<=20 years DA=15% of basic salary HRA=10% of basic salary Total salary=basic salary+DA+HRA.
a = input("Enter your name :")
b = int(input("Enter your work experience in years :"))
c = input("Enter your gender(male or female) :")
d = int(input("Enter your basic salary :"))
if c == "female":
if 0 <= b <= 20:
e,f = (15/100)*d,(10/100)*d
elif 21 <= b <= 30:
e,f = (30/100)*d,(15/100)*d
elif b > 30:
e,f = (40/100)*d,(25/100)*d
else:
print("Invalid input")
elif c == "male":
if 0 <= b <= 20:
e,f = (15/100)*d,(10/100)*d
elif 21 <= b <= 30:
e,f = (25/100)*d,(10/100)*d
elif b > 30:
e,f = (35/100)*d,(2/100)*d
else:
print("Invalid input")
else:
print("Invalid Input.")
print("Basic salary : "+str(d)+", DA : "+str(e)+", HDA : "+str(f)+", Total salary : "+str(d+e+f))


*Questions Prepared by--Srikanth.D

Mentor in IT,Dept of IT,RGUKT-SRIKAKULAM
duppada8@rguktsklm.ac.in



14

Projects

300

Minutes Of Support

5

Hard Worker