Question

Intro to Python Programming Campus GPA Design an app (that you could possibly deploy to a...

Intro to Python Programming Campus GPA Design an app (that you could possibly deploy to a smartphone) that would allow you to estimate the campus-wide average GPA. For example, you could use this app to stand out by the fountain and ask people for their GPAs. When you are finished gathering input, your program will then display the overall average GPA and the number of students surveyed. Implement the app using a "loop and a half." Choose a good sentinel value. Remember to avoid processing the sentinel value.

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

gpa_avg.py

# n for storing number of students
n = 0
# for storing total gpa
total_gpa = 0

# using loop to get student gpa
while 1:
    # used any negative gpa to terminate loop as gpa can not be negative
    input_gpa = float(input("Enter GPA or any negative number to terminate: "))
    # checking for sentinel value
    if input_gpa < 0:
        break
    # adding to total gpa
    total_gpa += input_gpa
    # adding to count
    n += 1

# printing the info
print("\nOverall Average GPA: {:.2f}".format(total_gpa / n))
print("number of students surveyed:", n)

# OUT

Enter GPA or any negative number to terminate: 4 Enter GPA or any negative number to terminate: 7 Enter GPA or any negative n

Please do let me know if u have any concern....

Add a comment
Know the answer?
Add Answer to:
Intro to Python Programming Campus GPA Design an app (that you could possibly deploy to a...
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
  • Could anyone please help with this Python code assignment? In this programming assignment you are to...

    Could anyone please help with this Python code assignment? In this programming assignment you are to create a program called numstat.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The count of how many numbers are in the file. The average of the numbers. The average is the sum of the numbers divided by how many there are. The maximum value. The...

  • Could someone please help me write this in Python? If time allows, it you could include...

    Could someone please help me write this in Python? If time allows, it you could include comments for your logic that would be of great help. This problem involves writing a program to analyze historical win-loss data for a single season of Division I NCAA women's basketball teams and compute from this the win ratio for each team as well as the conference(s) with the highest average win ratio. Background Whether it's football, basketball, lacrosse, or any other number of...

  • Could anyone help add to my python code? I now need to calculate the mean and...

    Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...

  • PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will...

    PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will guide you in starting the program in a methodical way. The program will display a window with GUI widgets that are associated with particular functions: Employee Payroll O X -- - - - - - - - - - - Show Payroll Find Employee by Name Highest Lowest Find Employee by Amount Write Output to Fie Cancel - -------- ------------- Notice that some of...

  • Please use own words. Thank you. CASE QUESTIONS AND DISCUSSION > Analyze and discuss the questions...

    Please use own words. Thank you. CASE QUESTIONS AND DISCUSSION > Analyze and discuss the questions listed below in specific detail. A minimum of 4 pages is required; ensure that you answer all questions completely Case Questions Who are the main players (name and position)? What business (es) and industry or industries is the company in? What are the issues and problems facing the company? (Sort them by importance and urgency.) What are the characteristics of the environment in which...

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