Select Page

Walden University Rainfall Program with Python Programming Project

Question Description

I’m working on a python exercise and need support to help me study.

Program 5: Functions

Write a program that asks the user to enter daily rainfall amounts. Your program will need to accept 20 daily rainfall inputs. Only allow non-negative rainfall amounts. When the user enters a negative number, tell them that the number is invalid, and that they should enter another, valid value.

Calculate the total rainfall and the average rainfall. Determine the largest daily rainfall and the smallest daily rainfall.

Output the total, average, largest, and smallest values using informative messages.

The following things cannot happen in the main program:

  • Accepting user input
  • Calculation of total or average – these functions should not print anything
  • Determination of largest or smallest – these functions should not print anything
  • Outputting results

Rather than doing these things in main, implement each feature in its own separate function and call each function from main.

Hints:

  • Start out by asking the user to enter just a few values rather than 20 – this is easier for repeated testing! Once the program is working, if we build it properly, it should be very easy to change the number of inputs to 20 or any other number.
  • How are we going to store several (and later, 20) values? We could declare 20 variables, but isn’t there a better way . . . ?
  • Think about which functions you are going to need. A big hint here is reading the list of things that you are not allowed to do in main. If you can’t do them in main, you’re going to need to do them in . . . ?
  • Once you identify the functions you are going to need, start thinking about parameters and return types. Which functions require which of each?
  • START EARLY ON THIS PROGRAM! If you start early and get stuck, or if you can’t figure out how to get started, that’s OK! Reach out to the tutors or myself, tell us what you have been thinking about doing and why it isn’t working, and we’ll help to get you off and running! If you wait until the last day(s) then there will be little time for the tutors or myself to help.

Please submit:

  1. a text file containing your source code (the code that you wrote – .py extension)
  2. an image (or images) showing your program running on your workstation

Rubric:

All functions implemented

50%

Main properly tests all functionality

20%

Well-formatted code (indentation, whitespace, variables, comments, etc.)

10%

Well-formatted output (columns, spacing, newlines, etc.)

10%

Screenshots showing your program running on your computer

10%

"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."

Order Solution Now