Robotics & Artificial Intelligence
Write a program to store marks of your class students and show their percentage.
Answer
n = int(input("Enter number of students: "))
max_marks = int(input("Enter maximum marks: "))
names = []
percentages = []
for i in range(n):
name = input("Enter student name: ")
marks = int(input("Enter total marks: "))
percentage = (marks / max_marks) * 100
names.append(name)
percentages.append(percentage)
print("\nStudent Name and Percentage")
for i in range(n):
print(names[i], "-", percentages[i], "%")Output
Enter number of students: 3
Enter maximum marks: 300
Enter student name: Asha
Enter total marks: 250
Enter student name: Ravi
Enter total marks: 208
Enter student name: Neha
Enter total marks: 290
Student Name and Percentage
Asha - 83.33333333333334 %
Ravi - 69.33333333333334 %
Neha - 96.66666666666667 %
Related Questions
Write a Python program to demonstrate the use of the if-elif-else statements.
Write a python program to print a pyramid using 'for' loop.
Write a program to implement a simple shopping cart system. In it user can add items, remove items, view the cart, and calculate the total cost.
Write a program that inputs two tuples and creates a third one that contains all the elements of the first tuple followed by all the elements of the second tuple.