Question

Write a Python script that allows a user to input three exam scores. Display a congratulatory...

Write a Python script that allows a user to input three exam scores. Display a congratulatory message if the average exam score across all three is greater than 95%. Your solution should follow these general steps;

  1. Obtain the first exam score from the user in the form score/max
    1. Example: 93/100
  2. Obtain the second score
  3. Obtain the third score
  4. Check that the user provided numbers and compute the average test score
  5. Display the average
  6. If the average was greater than 95%, display a congratulatory message
    1. Example: "Great work! Your average was over 95%!!!!"
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Screenshot of the code:

Sample Output:

Code to copy:

# Initialize the variable average to 0

average = 0

# Prompt the user to enter the score for 1st exam.

# The score should be in the form score/max

s1=input("Enter exam 1 score: ")

# Prompt the user to enter the score for 2nd exam.

s2=input("Enter exam 2 score: ")

# Prompt the user to enter the score for 3rd exam.

s3=input("Enter exam 3 score: ")

# Extract the marks and convert them to integer format.

# The score is split at the symbol '/' and the part

# which is before '/' is stored in the variable s1.

s1=int(s1.split("/")[0])

# Extract the marks and convert them to integer format.

# The score is split at the symbol '/' and the part

# which is before '/' is stored in the variable s2.

s2=int(s2.split("/")[0])

# Extract the marks and convert them to integer format.

# The score is split at the symbol '/' and the part

# which is before '/' is stored in the variable s3.

s3=int(s3.split("/")[0])

# Compute the average of the scores s1, s2 and s3.

average=(s1+s2+s3)/3

# Print the average computed score.

print("Average = %.1f" %average)

# If the average score is greater than 95, print the

# required statement.

if(average>=95):

   print("Great work! Your average was over 95%!!!!")

Add a comment
Know the answer?
Add Answer to:
Write a Python script that allows a user to input three exam scores. Display a congratulatory...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that allows the user to enter a series of exam scores. The number...

    Write a program that allows the user to enter a series of exam scores. The number of scores the user can enter is not fixed; they can enter any number of scores they want. The exam scores can be either integers or floats. Then, once the user has entered all the scores they want, your program will calculate and print the average of those scores. After printing the average, the program should terminate. You need to use a while loop...

  • Write a Python program that asks the user to type in their three quiz scores (scores...

    Write a Python program that asks the user to type in their three quiz scores (scores between 0 and 100) and displays two averages. The program should be written so one function gets the user to input a score, another function takes the three scores and returns the average of them. And another function takes the three scores and averages the two highest scores (in other words, drops the lowest). Each of these functions should do the computation and return...

  • Write a program named ClassifyScores that classifies a series of scores entered by the user into...

    Write a program named ClassifyScores that classifies a series of scores entered by the user into ranges (0-9, 10-19, and so forth). The scores will be numbers between 0 and 100. Design and implement a program to prompt the user to enter each score separately. If the score is within the correct range, then increment the appropriate range If the score entered is greater than 100, display an error message, ignore the incorrect score, and prompt for the user to...

  • Python Script format please! 1. Write a script that takes in three integer numbers from the...

    Python Script format please! 1. Write a script that takes in three integer numbers from the user, calculates, and displays the sum, average, product, smallest, and largest of the numbers input. Important things to note: a. You cannot use the min() or max() functions, you must provide the logic yourself b. The calculated average must be displayed as an integer value (ex. If the sum of the three values is 7, the average displayed should be 2, not 2.3333). Example:...

  • have to create five different functions above and call it in the main fucntion. Project Exam...

    have to create five different functions above and call it in the main fucntion. Project Exam Statistics A CIS 22A class has two midterm exams with a score between 0 and 100 each. Fractional scores, such as 88.3 are not allowed. The students' ids and midterm exam scores are stored in a text file as shown below // id exam1 exam2 DH232 89 92 Write a program that reads data from an input file named exams.txt, calculates the average of...

  • Write a Python program that does the following: Obtains the following input from a user: Mileage...

    Write a Python program that does the following: Obtains the following input from a user: Mileage at beginning of measurement period Mileage at end of measurement period Gallons of fuel consumed Calculates and displays: Miles driven Miles per gallon Kilometers driven Liters of fuel consumed Kilometers per liter Incorporate some Selection structure logic into it: If a vehicle gets less than 15 miles per gallon, display the message:       "Your vehicle has criminally low fuel efficiency." If it gets 15...

  • Write a Python (3) program to simulate** a buffer overflow (this is a new script, not...

    Write a Python (3) program to simulate** a buffer overflow (this is a new script, not part of the intranet assignment), then implement input validation to prevent it. There are two parts to this assignment: 1) The program should display a welcome message and prompt the user for a username. Create a simulated buffer overflow condition by allowing a user to input more data than the size of the allocated memory (causing the program to crash). 2) Implement input validation...

  • Write a Python Program Display the grades: Input: Enter the marks of the student Condition: Grade...

    Write a Python Program Display the grades: Input: Enter the marks of the student Condition: Grade A: Marks greater than 90 Grade B: Marks range from 81 to 90 Grade C: Marks range from 65 to 80 Fail: less than 65 Display the output. Example: Input: 95 Display: “student got Grade A” Input: 80 Display: “student got Grade C” Input: 64 Display: “student failed” Hint: Use else if (elif and logical operators)

  • Topics: list, file input/output (Python) You will write a program that allows the user to read...

    Topics: list, file input/output (Python) You will write a program that allows the user to read grade data from a text file, view computed statistical values based on the data, and to save the computed statistics to a text file. You will use a list to store the data read in, and for computing the statistics. You must use functions. The data: The user has the option to load a data file. The data consists of integer values representing student...

  • Write a Python program that does the following: Obtains the following input from a user: Mileage...

    Write a Python program that does the following: Obtains the following input from a user: Mileage at beginning of measurement period Mileage at end of measurement period Gallons of fuel consumed Calculates and displays: Miles driven Miles per gallon Kilometers driven Liters of fuel consumed Kilometers per liter Also incorporate some selection structure logic into it. If a vehicle gets less than 15 miles per gallon, display the message:       "Your vehicle has criminally low fuel efficiency." If it gets...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT