RECORD LIST-All Program

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

RECORD LIST- CLASS XI 2020_21

3. STUDENT MARK PROCESSING


#Code to print the name of the student and marks in 5 subjects
name=input("Enter your name: ")
eng=int(input("Enter the Mark in English: "))
phy=int(input("Enter the Mark in Physics: "))
che=int(input("Enter the Mark in Chemistry: "))
mat=int(input("Enter the Mark in Math: "))
cs=int(input("Enter the Mark in CS: "))
total=eng+phy+che+mat+cs
avg=(total)/5
print("\t\tStudent Mark List")
print("\t\t*****************")
print("Name of the student: ",name)
print("Mark in English: ",eng)
print("Mark in Physics: ",phy)
print("Mark in Chemistry: ",che)
print("Mark in Math: ",mat)
print("Mark in CS: ",cs)
print("Total Marks: ",total)
print("Average Marks: ",avg)
avg=int(avg)
if(avg>=90 and avg<=100):
print("Grade: A")
elif(avg>=75 and avg<90):
print("Grade: B")
elif(avg>=40 and avg<75):
print("Grade: C")
elif(avg<40):
print("Grade: D")
if eng>=40 and phy>=40 and che>=40 and mat>=40 and cs>=40:
print("Result: PASS")

else:
print("Result: FAIL")

4.
#temperature coding
num=float(input("Enter the temperature: "))
print("Type 1 to convert from Celsius to Farenheit")
print("Type 2 to convert from Farenheit to Celsius")
choice=int(input("Enter your choice: "))
print("\t\tTemperature Conversion")
print("\t\t**********************")
if choice==1:
far=num*(9/5)+32
print(num,"degree Celsius in Farenheit is equal to ",far)
elif choice==2:
cel = (num-32)*(5/9)
print(num,"degree Farenheit in Celsius is equal to ",cel)
else:
print("Enter only numbers 1 or 2")

5. #leap year coding


year=int(input("Enter the year to check:" ))
print("\t\t\t Leap Year Probability")
print("\t\t\t *********************")
print("\t\t\t Year:",year)
if(year%4 == 0):
if(year%100 == 0):
if(year%400 == 0):
print("\t\t\t",year,"is a Leap Year")
else:
print("\t\t\t",year,"is not the Leap Year")
else:
print("\t\t\t",year,"is a Leap Year")
else:
print("\t\t\t",year,"is not the Leap Year")

6. #Quadratic equation
a=int(input("Enter the co-efficient of x^2: "))
b=int(input("Enter the co-efficient of x: "))
c=int(input("Enter the value of constant: "))
d=(b**2)-(4*a*c)
root1=(-b)+(d**0.5)/(2*a)
root2=(-b)-(d**0.5)/(2*a)
print("\t\t\tRoots Calculation")
print("\t\t\t*****************")
print("\t\t\tCo-efficient of x^2: ",a)
print("\t\t\tCo-efficient of x: ",b)
print("\t\t\tValue of constant: ",c)
if d==0:
print("\t\t\tRoots are:",root1,"and",root2)
print("\t\t\tReal and Equal Roots")
elif d>0:
print("\t\t\tRoots are:",root1,"and",root2)
print("\t\t\tReal and Distinct Roots")
else:
print("\t\t\tImaginary Roots")

7. #code7
print("Menu Driven Program 1")
print("*********************")
while True:
print("1.Area of circle")
print("2.Perimeter of circle")
print("3.Exit")
choice=int(input("Enter your choice: "))
if choice==1:
radius=float(input("Enter the radius: "))
area=3.14*(radius**2)
print("Area of the circle: ",area)
elif choice==2:
radius=float(input("Enter the radius: "))
peri=2*3.14*radius
print("Perimeter of the circle: ",peri)
elif choice==3:
break
else:
print("Enter a valid option")
print("Its sad to see you go :(")

8. #code8
print("Menu Driven Code-II")
print("*****************")
choose="Y"
while choose.upper()=='Y':
print("1. Sum of n natural numbers")
print("2. Multiplication table of given number ‘n’ for ‘m’ multiples")
print("3. Exit")
choice=int(input("Enter the choice: "))
if choice==1:
num1=int(input("Enter the number to calculate the sum: "))
ans=0
for i in range(num1+1):
ans=ans+i
print("Sum of 'n' natural numbers is: ",ans)
elif choice==2:
num1=int(input("Enter the number for the multiplication table: "))
num2=int(input("Enter the number for the multiples: "))
for i in range(1, num2+1):
print(num1,"*",i,"= ",num1*i)
elif choice==3:
print("Thank you")
break
else:
print("Please enter a valid choice")
choose=input("Do you wish to continue? Y/N: ")
else:
print("Have a good day")
9. #Fibonacci
print("Fibonacci Series")
print("*************")
choose="Y"
while choose.upper()=='Y':
print("Main Menu")
print("************")
print("1. Fibonacci Series")
print("2. Exit")
choice=int(input("Enter the choice: "))
if choice==1:
num=int(input("Enter the number of terms: "))
first=0
second=1
for i in range(num):
print(first, end=' ')
third = first+second
first=second
second=third
elif choice==2:
print("Thank you")
break
else:
print("Please enter a valid choice")
choose=input("\nDo you wish to continue? Y/N: ")
else:
print("Have a good day")

10.#prime:
print("Prime numbers in Range")
print("******************************")
while True:
print("Main Menu")
print("************")
print("1.Prime number Calculation")
print("2.Exit")
choice=int(input("Enter your choice: "))
if choice==1:
n1 = int(input("Enter the Starting number: "))
n2 = int(input("Enter the To number: "))
if n1 and n2 >1:
print("Prime numbers between", n1, "and", n2, " :")
for num in range(n1, n2+1): #
for i in range(2, num):
if (num % i) == 0:
break
else:
print(num, end=" ")
choice=input("\nDo you wish to continue: y/n: ")
if choice.upper()=="N":
print("Have a good day")
break
elif n1==1 or n2==1:
print("1 is neither prime nor composite")
else:
print("Only Positive numbers please")
elif choice==2:
print("Have a good day")
break
else:
print("Enter a valid choice of 1 or 2")

11.#conversion
print("NUMBER CONVERSIONS")
print("******************")
while True:
print("Main Menu")
print("************")
print("1.Decimal to Binary")
print("2.Binary to Decimal")
print("3.Octal to Decimal")
print("4.Exit")
choice=int(input("Enter your choice: "))
if choice==1:
n1=int(input("Enter the decimal number: "))
binary=bin(n1)
print("The binary value is:",binary[2:])
elif choice==2:
n1=input("Enter the Binary number: ")
binary=int(n1,2)
print("The Decimal value is:",binary)
elif choice==3:
n1=input("Enter the Octal number: ")
binary=int(n1,8)
print("The Decimal value is:",binary)
elif choice==4:
print("Have a good day")
break
else:
print("Enter a valid choice of 1 or 2")

wish=input("Do you wish to continue: y/n: ")


if wish.upper()!="Y":
print("Have a good day")
break
12.#palindrome
print("Palindrome Check")
print("*****************")
while True:
print("Main Menu")
print("************")
print("1.Palindrome Check")
print("2.Exit")
choice=int(input("Enter your choice: "))
if choice==1:
msg=input("Enter the string to check: ")
rev=msg[::-1]
if rev.lower()==msg.lower():
print("Yes, the given string is a Palindrome")
else:
print("No, the given string is not a Palindrome")
elif choice==2:
print("Have a good day")
break
else:
print("Enter a valid choice of 1 or 2")
wish=input("Do you wish to continue: y/n: ")
if wish.upper()!="Y":
print("Have a good day")
break

13. #capitalize
print("CAPITALIZE EACH WORD")
print("*********************")
while True:
print("Main Menu")
print("**********")
print("1.String Capitalize")
print("2.Exit")
choice=int(input("Enter your choice: "))
if choice==1:
msg=input("Enter the string to capitalize: ")
newst=msg.title()
print("Capitalized String is: ",newst)
elif choice==2:
print("Have a good day")
break
else:
print("Enter a valid choice of 1 or 2")
wish=input("\nDo you wish to continue: y/n: ")
if wish.upper()!="Y":
print("Have a good day")
break
prime()

14. # List Operation


print("List Operation")
print("***************")
while True:
print("Main Menu")
print("**********")
print("1.List Operation")
print("2.Exit")
choice=int(input("Enter your choice: "))
if choice==1:
L=[]
num=int(input("No.of elements in the list: "))
for i in range(1,num+1):
ele=int(input("Enter the element %d: "%i))
L.append(ele)
print("\nThe entered List is: ",L)
L2=sorted(L)
print("1st highest element: ",L2[-1])
print("2nd highest element: ",L2[-2])
print("1st least element: ",L2[0])
print("2nd least element: ",L2[1])
elif choice==2:
print("Have a good day")
break
else:
print("Enter a valid choice of 1 or 2")
wish=input("Do you wish to continue: y/n: ")
if wish.upper()!="Y":
print("Have a good day")
break

15. # STRING WITH MAXIMUM VOWELS

print("String with Maximum Vowels")


print("**************************")
while True:
print("Main Menu")
print("**********")
print("1.String Operation")
print("2.Exit")
choice=int(input("Enter your choice: "))
if choice==1:
L1=[]
L=eval(input("Enter the list: "))
for word in L:
vow=0
for letter in word:
v='aeiou'
if letter.lower() in v:
vow+=1
L1.append(vow)
value=max(L1)
Litem=L1.index(value)
print("String with max %d vowels:"%value,L[Litem])
elif choice==2:
print("Have a good day")
break
else:
print("Enter a valid choice of 1 or 2")
wish=input("Do you wish to continue: y/n: ")
if wish.upper()!="Y":
print("Have a good day")
break

16.
print("Sorting")
print("********")
while True:
print("Main Menu")
print("**********")
print("1.Bubble Sort")
print("2.Insertion Sort")
print("3.Exit")
choice=int(input("Enter your choice: "))
if choice==1:
L=eval(input("Enter the list: "))
n=len(L)
for i in range(n-1):
for j in range(n-i-1):
if L[j]>L[j+1]:
L[j],L[j+1]=L[j+1],L[j]
print("Bubble Sorted List",L)
elif choice==2:
L=eval(input("Enter the list: "))
n=len(L)
for i in range(1,n):
for j in range(i,0,-1):
if L[j]<L[j-1]:
L[j],L[j-1]=L[j-1],L[j]
print("Sorted List",L)
elif choice==3:
print("Have a good day")
break
else:
print("Enter a valid choice of 1 or 2")
wish=input("Do you wish to continue: y/n: ")
if wish.upper()!="Y":
print("Have a good day")
break

17. #nested tuple


print("Nested Tuple")
print("*************")
while True:
print("1.Nested Tuple")
print("2.Exit")
choice=int(input("Enter your choice:"))
if choice==1:
allmean=0
from statistics import mean as avg
tup1 = eval(input("Enter the nested tuple: "))
l=len(tup1)
for i in range(l):
allmean+=avg(tup1[i])
print("The mean of the element",i+1,": ",avg(tup1[i]))
print("The mean of means is: ",allmean/l)
elif choice==2:
print("Have a good day")
break
else:
print("Enter a valid choice of 1 or 2")
wish=input("Do you wish to continue: y/n: ")
if wish.upper()!="Y":
print("Have a good day")
break

18. #dictionary
print("TELEPHONE DIRECTORY")
print("*******************")
while True:
print("1.Search for phone number")
print("2.Display Ph.No in sorted order")
print("3.Exit")
d1={9865:'A',12345:'B',86045:'C'}
choice=int(input("Enter your choice:"))
if choice==1:
num=int(input("Enter the Ph.No: "))
name=d1.get(num,"Ph.No doesn't exist")
print("The Ph.No belongs to: ",name)
elif choice==2:
newdict=sorted(d1)
print("Sorted Order of Ph.No: ",newdict)
elif choice==3:
print("Have a good day")
break
else:
print("Enter a valid choice of 1,2,3")
wish=input("Do you wish to continue: y/n: ")
if wish.upper()!="Y":
print("Have a good day")
break

You might also like