Question

4. For the following problem submit a photo of the flowchart and shots of your Python screens showing the program code and the output. Your task is to input from the teacher the test score of each student and to output the highest score. You need to check each score to make sure it is valid (at least 0 and at most 100). If it is not valid, keep prompting for a valid score until you get one. After a valid score is input, process it, and then ask the teacher if she has another score to enter. When you run the program, test the logic when the score entered is invalid when it is a valid score, and when the teacher says she has no more scores to enter. 5. For the following problem submit a photo of the flowchart and shots of your Python screens showing the program code and the output. There are 6 students in the group. Ask each student to enter the number of minutes it took them to complete the homework. Only accept a non-negative number. If the number entered is negative, keep prompting until a non-negative number is entered. Find the average number of minutes to complete homework. Print a message that includes the average number of minutes. Check the logic of your code by seeing what happens when you enter an invaliod number of minutes and when vou enter a valid number of minutes.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

def getScore():
while True:
score = int(input("Enter the score: \n"))
if score >= 0 and score <= 100:
print("Valid score")
break
else:
print("Invalid score")
return score

while True:
print(getScore())
choice = input("Do you want to enter more(yes/no):")
if choice != "yes":
break

def getMinutes():
while True:
minutes = int(input("Enter the minutes: \n"))
if minutes > 0:
print("Valid minutes")
break
else:
print("Invalid minutes")
return minutes

sum = 0
for i in range(6):
sum += getMinutes()
print("Avgerage = ", sum / 6.0)

Let me know if you have any queries or clarifications.... :)

Add a comment
Know the answer?
Add Answer to:
4. For the following problem submit a photo of the flowchart and shots of your Python...
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
  • PYTHON CODE PLEASEEEEE. Driver’s License Exam 20PTS PYTHON AND FLOWCHART The local driver’s license office has...

    PYTHON CODE PLEASEEEEE. Driver’s License Exam 20PTS PYTHON AND FLOWCHART The local driver’s license office has asked you to design a program that grades the written portion of the driver’s license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1.B 6.A 11.B 16.C 2.D 7.B 12.C 17.C 3.A 8.A 13.D 18.B 4.A 9.C 14.A 19.D 5.C 10.D 15.D 20.A Your program should store these correct answers in an array. (Store each question’s correct answer in...

  • In python, Implement a function studentID() which allows the user to enter the 7-digit student ID....

    In python, Implement a function studentID() which allows the user to enter the 7-digit student ID. The program will keep prompting the user for a last name and first name. If the student does not have a student ID on record, the program will then ask for the student ID, and store that information. If the student already has a student ID, the program will display it, and ask for confirmation whether a new studentID should be assigned (and, if...

  • Flowchart for Python program: Design and create a program for the ULM Coffee Shop to provide...

    Flowchart for Python program: Design and create a program for the ULM Coffee Shop to provide some customer market research data. When a customer places an order, a clerk asks for the customer’s zip code and age. The clerk enters that data as well as the number of items the customer orders. The program operates continuously until the clerk enters a 0 for zip code at the end of the day. When the clerk enters an invalid zip code (more...

  • 1) Which of the following is NOT true about a Python variable? a) A Python variable...

    1) Which of the following is NOT true about a Python variable? a) A Python variable must have a value b) A Python variable can be deleted c) The lifetime of a Python variable is the whole duration of a program execution.   d) A Python variable can have the value None.        2) Given the code segment:        What is the result of executing the code segment? a) Syntax error b) Runtime error c) No error      d) Logic error 3) What...

  • build a phone number from digits entered by your user. Your program will loop until 10...

    build a phone number from digits entered by your user. Your program will loop until 10 valid digits have been entered. It will then use those digits to display the phone number entered using the format: XXXXXXXXXX (or (XXX) XXX – XXXX for extra credit). The program will ask for a digit, it will check to see if the digit is actually between 0 and 9 inclusively. If so, the digit will be stored as the next number in the...

  • Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that...

    Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that uses iteration to guess a number from 1 to 10. Each lab asks you to write pseudocode that plans the program’s logic before you write the program in Python and to turn in three things: 1) the pseudocode, 2) a screenshot of the output, and 3) the Python program. Instructions Write pseudocode for a Python program that uses iteration to guess a number from...

  • Python Coding Help

    How to write a code for this?When the program starts the bowler is prompted for a score for ‘Game 1’Accept the bowling score from the user; valid bowling scores are whole numbers between 0 and 300.Once a valid numeric score is entered then perform range validation to ensure it is within the required entry range. If the bowler enters a value outside of the acceptable range, or for any entries that aren’t whole numbers, the program should display an appropriate...

  • Card Game Simulation(in Python 3.8.1) The purpose of this assignment is to help you gain experience...

    Card Game Simulation(in Python 3.8.1) The purpose of this assignment is to help you gain experience using while loops to solve problems. For this assignment, you will simulate a simplified card game that has some similarity to the game of 21. At the start of the program, the user will be asked to supply both the winning score (an integer from 1 thru 21) and the number of times to run the simulation (an integer from 100 to 100,000). To...

  • Consider the following code. while (!(productCode >= MIN_PRODUCT_CODE) || !(productCode <= MAX_PRODUCT_CODE)) { System.out.println("!!! Invalid product...

    Consider the following code. while (!(productCode >= MIN_PRODUCT_CODE) || !(productCode <= MAX_PRODUCT_CODE)) { System.out.println("!!! Invalid product code"); System.out.print("Enter product code:"); productCode = Integer.parseInt(input.nextLine()); } My question is ... how you keep entering user until is valid? When I entered any number that is invalid input, works fine. I keep entering input value. However, when I entered A , it terminates the program. How do I keep entering the user even if the inputs are String? Enter product code: a Exception...

  • Write a code using loop and flag function in python jupitior notebook: Ask the user for...

    Write a code using loop and flag function in python jupitior notebook: Ask the user for the number of items they bought. Also ask the price of each item they bought and quantity purchased. Display the total amount they owe. Ask the user for a number n. Calculate 1+2+3+….+n. Ask the user for a number n. Calculate 1*2*3*…*n. Ask the user for number of rows (r) and columns (c). Print * for r rows and c columns. Ask the user...

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