Page 431 - AI Ver 3.0 Class 11
P. 431
Practical Questions
#Coding & Computational Thinking
1. Go to https://freddiemeter.withyoutube.com/
Are you able to sing like Freddie Mercury? A question you probably never asked yourself. However,
Freddiemeter will provide the solution. This game can be played with the family: you sing, and
the AI informs you how excellent or bad you are. (The website will ask for your microphone and
webcam permissions).
2. Write a program to accept the marks of 5 students from the user. Calculate and display the average marks of the
students.
# Initialize the total marks to 0
total_marks = 0
# Accept marks from the user and calculate the total
for i in range(5):
mark = float(input("Enter the marks:"))
total_marks += mark
# Calculate the average
average_marks = total_marks / 5
# Display the average
print("The average marks of the 5 students is:",average_marks)
Output:
Enter the marks: 45.6
Enter the marks: 67.5
Enter the marks: 78.5
Enter the marks: 80
Enter the marks: 77
The average marks of the 5 students is: 69.72
3. Write a menu driven program to display the sum or product of three numbers as per user’s choice.
# Display the menu and get user's choice
print("Menu:")
print("1. Sum of three numbers")
print("2. Product of three numbers")
choice = int(input("Enter your choice (1 or 2): "))
# Get three numbers from the user
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
num3 = int(input("Enter the third number: "))
# Calculate and display the result based on the user's choice
if choice == 1:
sum = num1 + num2 + num3
print("The sum is:",sum)
elif choice == 2:
prod = num1 * num2 * num3
print("The product is:",prod)
Practical Questions 429

