Tomorrow Lab Programs
Tomorrow Lab Programs
4) If the first name of a student is input through the keyboard, write a program to display the
vowels and consonants present in his/her name.
Program:
c=0
v=0
name=input("Enter your name:")
for ch in name:
if ch=='a' or ch=='A':
print(ch)
v=v+1
elif ch=='e' or ch=='E':
print(ch)
v=v+1
elif ch=='i' or ch=='I':
print(ch)
v=v+1
elif ch=='o' or ch=='O':
print(ch)
v=v+1
elif ch=='u' or ch=='U':
print(ch)
v=v+1
else:
c=c+1
5) The marks obtained by a student in 5 different subjects are input through the keyboard. Find
the average and print the student grade as per the MITS examination policy as shown below.
% OBTAINED GRADE
90 - 100 O (Outstanding)
80 - 89 A+ (Excellent)
70 - 79 A (Very Good)
60 - 69 B+ (Good)
50 - 59 B (Above)
45 - 49 C (Average)
40 - 44 P (Pass)
< 40 F (Fail)
Program:
n=int(input("Enter the No. of Subjects:"))
total=0
avg=0
for i in range(1,n+1):
marks=int(input("Enter your subject Marks="))
total=total+marks
print(total)
avg=float(total/n)
print(round(avg,2))
if(avg>=90):
print("O (Outstanding)")
elif(avg>=80 and avg<90):
print("A+ (Excellent)")
elif(avg>=70 and avg<80):
print("A (Very Good)")
elif(avg>=60 and avg<70):
print("B+ (Good)")
elif(avg>=50 and avg<60):
print("B (Above)")
elif(avg>=45 and avg<50):
print("C (Average)")
elif(avg>=40 and avg<45):
print("C (Average)")
else:
print("Fail")
7) Write a program to find all Armstrong number in the range of 0 and 999.
for num in range(0, 1000):
order = len(str(num))
sum = 0
n = num
while n > 0:
r = n % 10
sum = sum + r ** order
n = n // 10