0% found this document useful (0 votes)
2 views

Programs

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Programs

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

7) #Write a program to create a list of students' marks with user defined

values and find the maximum.


Program
import numpy as np
a= int(input("Enter marks for first subject "))
b= int(input("Enter marks for second subject "))
c= int(input("Enter marks for third subject "))
d= int(input("Enter marks for fourth subject "))
e= int(input("Enter marks for fifth subject "))
arrayone= np.array([a,b,c,d,e])
print(np.max(arrayone))
Output
Enter marks for first subject 98
Enter marks for second subject 99
Enter marks for third subject 97
Enter marks for fourth subject 100
Enter marks for fifth subject 95
100
8) #Write a program to print a multiplication table of the entered
number.
Program
numberone=int(input("Enter a number:"))
for i in range(1,11):
print(numberone,"x",i,"=",numberone*i)
Output
Enter a number:55
55 x 1 = 55
55 x 2 = 110
55 x 3 = 165
55 x 4 = 220
55 x 5 = 275
55 x 6 = 330
55 x 7 = 385
55 x 8 = 440
55 x 9 = 495
55 x 10 = 550
9) #Write a program to check whether the number is prime or not.
Program
a=int(input("Enter a Number:"))
if a>1:
for i in range(2,int(a/2)+1):
#by largest factor theorem, we have check till
a/2 so a/2+1
if (a%i)==0:
print(a,"not a prime number")
break
else:
print(a,"is a prime number")
Output
Enter a Number:45
45 not a prime number
10) #Write a python program to represent the data on the ratings of
mobile games on a bar chart. The sample data is given as; games: Pubg,
Free Fire, Minecraft, Gta-V, Call Of Duty. ratings: 4.5,4.8,4.7,4.6,4.1,4.3
Program
import matplotlib.pyplot as plt
Games=['Pubg','FreeFire','MineCraft','GTA-
V','CallOfDuty','FIFA 22']
Ratings=[4.5,4.8,4.7,4.6,4.1,4.3]
plt.bar(Games,Ratings,color="yellow")
plt.xlabel("GAMES")
plt.ylabel("RATINGS")
plt.title("RATING OF MOBILE GAMES")
plt.show()
Output

You might also like