Write a Python program (rainfall.py) to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. Then for each year, the program should ask twelve times, once for each month, for inches of rainfall for that month. At the end, , the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.

Your program should contain two functions:

(1) rainfall(year): This function takes in a year (integer) as a parameter, and returns two values (totalMonths and totalRainfall). In this function, you need to use nested loop. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for inches (float) of rainfall for that month. After all iterations, the function should return the number of months (totalMonths) and the total inches of rainfall (totalRainfall). (Submit for 4 points)

(2) __main__: In the main, you do the following: (Submit for 6 points)

a. Prompt the user to input the number of years. Reprompt the user if the number of years is 0 or less. Hint: use a while loop.
b. Call rainfall(year) and pass to it the value entered above.
c. Calculate the average based on the returned values from rainfall function.
d. Display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.

Answers

Answer 1

Answer:

def rainfall(year):

   totalMonths = totalRainfall = 0

   for y in range(year):

       for month in range(12):

           rainfall = float(input(f"Enter inches of rainfall for month #{month+1}: "))

           totalRainfall += rainfall

   totalMonths = year * 12

   return totalMonths, totalRainfall

def __main__():

   while True:

       year = int(input("Enter the number of years: "))

       if year > 0:

           break

   numberOfMonths, totalRainfall = rainfall(year)

   averageRainFall = totalRainfall / numberOfMonths

   print(f"\nTotal number of months: {numberOfMonths}")

   print(f"The total inches of rainfall: {totalRainfall}")

   print(f"The average rainfall per month for the entire period: {averageRainFall}")

if __name__ == '__main__':

   __main__()

Explanation:

Create a function named rainfall that takes year as a parameter

Inside the function:

Create a nested for loop. The outer loop iterates for each year (The range is from 0 to year-1) and the inner loop iterates for each month of that year (The range is from 0 to 11). Inside the inner loop, ask the user to enter the rainfall for that month. Add the rainfall to the totalRainfall (cumulative sum)

When the loops are done, calculate the totalMonths, multiply year by 12

Return the totalMonths and totalRainfall

Inside the main:

Create a while loop that asks user to enter the number of years while it is greater than 0

Call the rainfall function, passing the year as parameter. Set the numberOfMonths and totalRainfall using the rainfall function

Calculate the averageRainFall, divide totalRainfall by numberOfMonths

Print the results


Related Questions

What is not a type of text format that will automatically be converted by Outlook into a hyperlink?
O email address
O web address
O UNC path
O All will be automatically converted.

Answers

Answer:

UNC path seems to be the answer

Answer:

UNC path

Explanation:

As Jane was setting up her projector, she realized that the images on the screen appeared blurred. How would Jane sort out the issue by herself?
A.
check that the monitor is connected properly with the projector
B.
adjust the distance between the screen and the projector
C.
make changes in the system settings
D.
adjust the focus

Answers

it would be D, adjust the focus
The answer is D. Adjust the focus

Create a new Java program called MyInfo. Create one or more method(s) that pass the following information as parameters and prints it when the method is called. Full name Middle Initial Age Major GPA Once completed, paste code.

Answers

Answer:

Answered below

Explanation:

//Program in Java

class MyInfo{

public static void main (String args []){

myFullName("John", "Doe");

myAgeMajorGPA(20, "Biology", 4.3);

}

public void myFullName(String initialName, String middleName){

System.out.println(initialName);

System.out.print(middleName);

}

public void myAgeMajorGPA(int age, String major, double GPA){

System.out.println(age);

System.out.println(GPA);

System.out.print(major);

}

}

Computers were originally invented to
Group of answer choices
A.to share information on the Internet.

B.make complex mathematical calculations possible and make tasks easier for humans.

C.to play video games.

Answers

Answer:

B

Explanation:

It's B because why would it me made to play video games

Answer:

B

Explanation:

A, the internet didnt exist yet, so it cant be this

C, video games would require computers, so its ruled out on a similar basis as the previous

You are the administrative assistant for the Psychology Department in your college, and they have assigned you to set up a small server to provide basic file services to faculty, staff, and students in that department, which currently has 122 users. For example, faculty will use the server to post and receive class assignments. Which edition of Windows Server 2016 is most appropriate for this situation?

Answers

Answer: Standard edition

Explanation:

Based on the information given in the question, the edition of Windows Server 2016 that is most appropriate for this situation will be the standard edition.

Since it's going to be fora small server to provide basic file services to faculty, staff, and students in that department, which currently has 122 users, the standard edition is appropriate.

Standard edition is ideal in a scenario whereby there's a non-virtualized environments or low density with regards to the population.

Hi everyone,
for my undergraduate research project, I'm looking for an R code for agglomerative clustering. Basically, I need to know what happened inside hclust method in R. I have looked everywhere but don't find a proper way to combine 2 data points that have the smallest distance. I was stuck at developing a dissimilarity matrix after the first phase of dissimilarity matrix generation(literally I have generated the first dissimilarity matrix). I'm not specifying R, if anyone could give me a solution in any language I would gratefully accept that.

Answers

Answer:

Answer is being shown in the file to the link

A spinner is divided into 4 equal sections colored red, green, blue, and orange. Ennis spins the spinner. What is the probability that he dont not spin orange?

Answers

the probability would be 3/4

____ a device receiving a process variable

Answers

Answer:

Transmitter

Maybe this is the answer or the question is wrong.

Explanation:

In the world of process control, a Transmitter is a device that converts the signal produced by a sensor into a standard instrumentation signal representing a process variable being measured and controlled.

A resistor is found to have 3 A going through it with a voltage of 150 V. What is the resistance of the resistor?
10 points

Answers

Answer:

50 ohms

Explanation:

voltage = current * resistance, this is rearranged as

resistance = voltage / current, so if you plug in the numbers, you'll get

150/3,

resistance = 50 omhs

For current events, what type of sources would we use to learn about them?

A”Scholarly journals

B”News sources (broadcast, web, print)

C”Books

D”Reference works (encyclopedias, almanacs, etc.)

Answers

Answer:

B. News Sources (broadcast, web, print)

Explanation:

To learn about current events the most ideal sources of reference are News sources, either broadcast, web or print.

For example, if you're seeking breaking news or stories that are developing in the business world, the following sources are News sources you can turn to as sources of reference: CNN Business, Forbes, Bloomberg's Business Week, Fortune and other relevant Business News Media outfits.

Assume in the for loop header, the range function has the three arguments: range (1, 10, 3), if you were to print out the value of the variable
in the for loop header, what will be printed out? List the values and separate them with a comma.

Answers

Answer:

1, 4, 7

Explanation:

The instruction in the question can be represented as:

for i in range(1,10,3):

   print i

What the above code does is that:

It starts printing the value of i from 1

Increment by 3

Then stop printing at 9 (i.e.. 10 - 1)

So: The sequence is as follows

Print 1

Add 3, to give 4

Print 4

Add 3, to give 7

Print 7

Add 3, to give 10 (10 > 10 - 1).

So, it stops execution.

Fyroff consultants, a leading software consulting firm in the United States, decides to launch an Enterprise Resource Planning (ERP) solution. The company chooses the brand name Fyroff Enterprise for the new solution. However, when the company attempts to register the domain name, it finds that a small unknown firm is already registered under the same domain name. The small firm is now attempting to sell the domain name to Fyroff. Which of the following terms refers to this practice of buying a domain name only to sell it for big bucks?
a. cybersquatting
b. logic bombing
c. cyberbullying
d. bot herding
e. cyberstalking

Answers

Answer:

The correct answer is a. cybersquatting

Explanation:

Cybersquatting is the registration of a domain name that corresponds to the denomination of a brand or name, with the main objective of obtaining some economic benefit from its sale to the owner and legitimate owner of the brand. Cybersquatting can range from making money by parking domains (buying names that are then "parked", that is, left unused but generating advertising revenue based on the visits they receive) to redirecting users to another website In order for it to get more traffic, that is, with cybersquatting it is generally intended to sell the registered domain names to the legitimate owners or interested parties, at a price well above the cost of registration or also to use the domain taking advantage of the recognition associated with the legitimate owner to obtain commercial advantages, as clients in the network.

Write Python code to convert miles to kilometers. This does not need to be written in a Python function, but it should use the input()function. Running your code should produce a statement asking for the user to enter a number (in miles). Then it should print out a sentence of what that number is in kilometers. Use the conversion rate of 1 mile

Answers

Answer:

It can be so frustrating that the entire planet can't just agree on one system of measurement, whether it relates to measuring distances, weights, temperatures, etc (for the record...same goes for which side of the road everyone drives on). If every country used the same units of measurement, then these formulas would be useless and obsolete, but until then, it might be a good idea to understand how to convert miles to kilometers, and vice versa. If you're a Python developer, then knowing how to write the formulas in Python might be especially useful. Keep reading to see just how it's done.

Converting miles to km isn't especially difficult. To do a rough estimate of the conversion in your head, all you really need to remember is that a mile equals about 1.6 kilometers (or that a kilometer is approximately 2/3 of a mile). When trying to find the correct conversion using a formula, we must use the more precise conversion factor, which is equal to 0.62137119.

To convert miles to kilometers, the formula is very straightforward. All you need to do is divide the number of miles by the conversion factor. To see how it would look written out in Python, check out the example below:

Explanation:

Answer:

All you need to convert the Python code is TWO variables, a Outcome variable and a income variable.

Explanation:

i Hope this helps u

Bugs always seem to creep into programs and code. What strategies have you learned to find bugs more easily and crush them with a fix?

Answers

The process involves in  finding bugs as well as crushing them in a debugging process is extensive and this can consist of following process;

Examination of the error symptoms

 identifying the cause of it

 fixing of the error.

 This process is usually required a large amount of work, Although no precise procedure that is set in  for fixing all error, but some  useful strategies that use in reducing the debugging effort.

One of the significant part of this process is  localizing of  the error, which is figuring out the cause as well as the symptoms. Strategies that I have learnt in finding and fixing the error in the process of debugging includes;Incremental as well as  bottom-up program development; development of the program incrementally remains one of the most effective ways that can be used in localizing the error, often testing as the piece of code is added, so with this it will be easier to find the error since any error is from the last piece of code added.And also since the last fragment of the code will be small then searching for bugs won't take much time to find and debug.Bottom-up development helps in  maximizing  the benefits that comes from incremental development. With bottom-up development, after successful testing of a code, it's behavior will not change once another piece is added to it, since existing code will never replied on new part so it will be easier to trace error in the new code and fix it.Instrument program can be used to log information and there can be insertion of print statements.Instrument program using assertions; Assertions  can be used in checking if the program actually maintains the properties or  those invariant that the code relies on,     Because the program will definitely stops once the  assertion fails, and there is actuality that the point where the program reached and  stops is closer to the cause, as well as  good indicator of how the problem looks like , then the bug can then be fixed.breakpoints can be set in the program as well as stepping and over functions, then watching program expressions, as well as  inspection of  the memory contents at a particular point during the execution can give the needed run-time information.Backtracking: this option works in a way whereby one will need to start from the point that the problem occurred then go back through the code to to detect the issue, then the bug can then be fixed.Binary search: this is exploration of the code by using divide and conquer approach, so that the  the bug be pin down quickly.

Therefore, Bugs are treat to programs and they can be dealt with using discussed methods.

Learn more at: https://brainly.com/question/15289374?referrer=searchResults

Write a program that asks for the number of units sold and computes the total cost of the purchase. Input validation: Make sure the number of units is greater than 0. Use output (stream) manipulators: 2 digits after the decimal point g

Answers

Answer:

Explanation:

The following code is written in C++, it asks the user for input on number of units sold and places it in a variable called units_sold. Then it asks for the package price and places that value in a variable called package_price. Finally it multiplies both values together into a variable called final_price and adjusts the decimals.

#include <iostream>

#include <iomanip>

using namespace std;

       int main()

       {

       // Variables

       int units_sold,

       final_price;

       // ask user for number of units sold

       cout << "\nEnter number of units sold: ";

       cin >> units_sold;

       

       //ask for Package price

       cout << "\nEnter Package Price: ";

       cin >> package_price;

       // Total amount before discount

       final_price = units_sold * package_price;

       cout << setprecision(2) << fixed;

       cout << endl;

       return 0;

       }

The following segment of code is meant to remove the even numbers from an ArrayList list and print the results:

int counter = 0;
while(counter < list.size())
{
if(list.get(counter) %2 == 0)
{
list.remove(counter);
}
counter++;
}
System.out.println(list.toString());
The method as written, however, is incorrect. Which ArrayList(s) list would prove that this method was written incorrectly?

I.
[1, 2, 3, 4, 5]
II.
[2, 4, 5, 6, 7]
III.
[2, 4, 6, 8, 10]
IV.
[2, 5, 6, 7, 8]
III only


II and IV


II only


I and IV


II and III

Answers

Answer:

II and III

Explanation:

I took the quiz and got this wrong, but it gives you the answer afterwards, just trying to help everyone else out.

Answer:

II and III

Explanation:

What is a fundamental difference between the SAP platform and the AirBnB platform?

Answers

The fundamental difference between the SAP platform and the AirBnB platform is that;

SAP is an enterprise resource planning platform and AirBnb is a collaborative platform

SAP and AirBnB SAP ERP is defined as an enterprise resource planning software developed by the German company SAP SE. Thus, it is used to assist companies with the management of business areas involving finances, logistics and human resources.

Meanwhile AirBnB is collaborative platform that allows property owners to list their place as holiday accommodation in order to permit travellers to locate somewhere to stay when they are away from home and family.

Read more about management tools at; https://brainly.com/question/17493537

How have newspapers and magazines adapted to digital technology? Give at least two examples.

Answers

Firstly, the newspaper is a reliable source of information as the news, critics, pictures have gone through professional journalists and editors that does not publish any unreliable information. 

Secondly,  in this digital age there are still old folks that are not techno-savvy and poor people that cannot afford to be connected to the society.

Hence, at this point of time, the newspaper still comes to play as it is the most affordable and alternative method from online news while still providing information for the old and poor. Thus, newspapers still have a role in my society in this digital age. 

Answer:

They have adapted to digital technology by creating apps for their readers to access their content on their phones or computers.

Explanation:

I Hope this helps.

What Is the Purpose of a Web Browser? *

Answers

A web browser takes you anywhere on the internet. It retrieves information from other parts of the web and displays it on your desktop or mobile device. The information is transferred using the Hypertext Transfer Protocol, which defines how text, images and video are transmitted on the web.

Answer:

This is your answer. If I'm right so,

Please mark me as brainliest. thanks!!!

Select the true statement about network protocols.A protocol determines how the sending computer notifies the receiving computer about the presence of compressed data.A protocol determines how it will be executed on every networked device.A protocol determines how the sending device notifies the receiving device that there is data to be sent.A protocol is not required for all data transmissions.

Answers

Answer:

A protocol determines how the sending device notifies the receiving device that there is data to be sent.

Explanation:

A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to create, store, modify, retrieve and manage data or informations in a database. Generally, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.

A protocol can be defined as a standard set of rules established by the regulatory agencies to determine how data are transmitted from one network device to another.

Generally, the standard Internet communications protocols which allow digital computers to transfer (prepare and forward) data over long distances is the TCP/IP suite.

A protocol determines how the sending device notifies the receiving device that there is data to be sent, regardless of any difference in terms of structure or design.

How have newspapers and magazines adapted to digital technology?

Answers

Answer:

Most newspapers now have online editions. Subscription models have gone beyond print-only into digital-only and print-digital combinations -- and as print-only circulation is dropping, digital and combination circulation is on the rise.

When gathering the information needed to create a database, the attributes the database must contain to store all the information an organization needs for its activities are _______ requirements.

Answers

Answer:

Access and security requirements

Order the steps to autofilter data

Answers

Answer:

Select the data you want to filter.

Click Data > Filter.

Click the arrow. ...

Choose specific values: Uncheck (Select All) to clear all of the check boxes, and then check the boxes for the specific value(s) you want to see.

Explanation:

1. Select the data you want to filter.

2. Click Data > Filter.

3. Click the arrow. ...

4. Choose specific values: Uncheck (Select All) to clear all of the check boxes, and then check the boxes for the specific value(s) you want to see.

Answer:

Select any cell in the data range > Click the data tab > Go to the sort & filter group > Click filter and select proper controls

Explanation:

i got it right lol :)

It is desired to create a mortgage estimator by writing a program containing a function. The user inputs the amount of loan (L), the loan term in number of months (W, and the annual interest rate (D in the script. The script then makes use of a function that accepts these values as inputs through its argument and calculates and returns the monthly payment and the total payments over the life of the loan. The monthly payment and the total payment could be calculated using the following expressions:
monthly payment 1-(1+ 1 112) N I/12 total payment Nxmonthly payment
Note that the interest rate must be expressed in decimal; for example, if the interest rate is 8% it must be entered as 0.08 Test your program for several scenarios and submit the results with the program listing.
The values of L, I, monthly payment, and total payment should be written to a file as shown below:
Interest Loan Amount Interest Months Monthly Payment Total Payment
0.06 10000 36
108 120000 0.05
0.07 85000 48
0.08 257000 240
0.05 320000 120

Answers

Answer:

In Python:

L = int(input("Loan Amount: "))

N = int(input("Months: "))

I = float(input("Annual Interest Rate: "))

monthly_payment = round(L/((1 - (1 + I/12)**(-N))/(I/12)),2)

total_payment = round(N * monthly_payment,2)

 

f= open("outputfile.txt","a+")

f.write(str(L)+"\t\t"+str(I)+"\t\t"+str(N)+"\t\t"+str(monthly_payment)+"\t\t"+str(total_payment)+"\n")

Explanation:

The next three lines get the required inputs

L = int(input("Loan Amount: "))

N = int(input("Months: "))

I = float(input("Annual Interest Rate: "))

Calculate the monthly payment

monthly_payment = round(L/((1 - (1 + I/12)**(-N))/(I/12)),2)

Calculate the total payment

total_payment = round(N * monthly_payment,2)

Open the output file

f= open("outputfile.txt","a+")

Write output to file

f.write(str(L)+"\t\t"+str(I)+"\t\t"+str(N)+"\t\t"+str(monthly_payment)+"\t\t"+str(total_payment)+"\n")

BINARY DATA:

00000000 00000000 00001100 00000111 10101100 00001010 01111000 00101011 11001011 10011101 00111001 11110011
00001000 00000000 01000101 00000000 00000000 00101000 00000010 10001110 01000000 00000000 10000000 00000110
00000000 00000000 00001010 01111011 00001010 00100001 01101011 00010100 11011001 10101011 00111000 00010111
00000000 01010000 01001100 00100001 00011000 00001001 10011101 01100010 10100011 10001011 01010000 00010000
01000000 10110000 01011001 01110110 00000000 00000000

Required:
a. How do you know this is an IP packet?
b. What is the embedded protocol?
c. What is the size of the embedded protocol payload?

Answers

Answer:

A.

Explanation:

Answer:

a

Explanation:

Analyzing Types of Graphics
In which situation would a floating image be more useful than an in-line image?
O You want the image to stay within a specific paragraph of text.
O You want the image to come from a gallery of photos in your camera.
You want the image to be on the final page no matter what happens to the text.
O You want a screen-capture image of a software program on your computer.

Answers

Answer:you want the image to be on the final page no matter what happens to the text.

The situation that a floating image be more useful than an in-line image when you want the image to be on the final page no matter what happens to the text.

What helps in float image?

The use of Cascading Style Sheets is known to be a float property that often functions to help place images on a web page.

Conclusively, given the situation above, that a floating image be more better than an in-line image only if you want the image to be on the final page no matter what occurs in the text.

Learn more about Graphics from

https://brainly.com/question/25817628

When text is used as a Hyperlink, it is usually underlined and appears as a different color.

Question 3 options:
True
False

Answers

True it usually shows up with a blue underline

Return a formatted string with numbers The function below takes three numerical inputs: num1, num2, and num3. Implement it to return a formatted string with an underscore between the first two numbers and space, exclamation point, and another space between the second and third number. For example, if the inputs are 1, 2, and 3, then the function should return the string '1_2 ! 3'.

Answers

Answer:

In Python:

def ret_formatted(num1,num2,num3):

   result = str(num1)+"_"+str(num2)+" ! "+str(num3)

   return result

Explanation:

This defines the function

def ret_formatted(num1,num2,num3):

This generates the output string

   result = str(num1)+"_"+str(num2)+" ! "+str(num3)

This returns the result string

   return result

80. A .......... is used to read or write data.
A. CD B. VDU C. ROM D. RAM​

Answers

Answer:

Depending on exactly what they mean by read and write, both A and D are valid.  In fact, if you read that as "read or write" as being a logical OR and not the logical AND that the sentence probably intends, then all four answers could be correct.

What they probably mean to say though is "..... is used as a read/write storage medium", in which case A is the correct answer.

A.  Data can be written to or read from a CD.  This is probably the "right" answer

B. A human can "read" data from a Visual Display Unit, and the computer "write" it.  That of course is not the intended meaning though.

C.  Data can be read from Read Only Memory, but not written to.

D. Data can be both read and written to Random Access Memory, but not retained after the computer is powered off.

Creative Commons material often costs money to use.

True
False

Answers

Answer:

true

Explanation:

Other Questions
If 54% of all people between the ages of 35 and 50 ride a bike, find the probability for a sample of 30 people in that age group exactly 15 ride a bike A dune buggy company rents dune buggies at the beach. They charge an initial fee of $30 plus$10 for each hour the buggy is rented. Let x represent the number of hours and y represent thetotal cost of the rental.b. What is the slope-intercept equation of the line that fits this information? Put the equation y =x^2-8x + 12 into the form y(x-h)^2+kAnswer: y = PLZ HELP THIS IS TIMED;(((((( Can someone please help me with math. PLEASE HELP600 miles in 8 hours_?_miles per hour Who was the real first president of the United States? how do the facts presented in a informational text help shape a opinion? What is the area of the parallelogram? List 1 way World War II promoted discrimination in the U.S. Im failing literally every single class and Im still online The dull thud of the gas-shells mingles with the crashes of the light explosives. A bell sounds between the explosions, gongs, and metal clappers warning everyone-Gas-Gas-Gaas. These first minutes with the mask decide between life and death: is it air tight? I remember the awful sights in the hospital: the gas patients who lay in day-long suffocation cough up their burnt lungs in clots. Cautiously, the mouth applied to the valve, I breathe. The gas still creeps over the ground. .. like a big, soft jelly-fish Inside the gas-mask my head booms and roars-it is nigh bursting. My lungs are tight, they breathe always the same hot, used up air, and the veins on my temple are swollen. I feel I am suffocating. The excerpt above shows evidence of which type of warfare: A. Formation Warfare Shelling Warfare B. Gas warfare and Trench warfare C. All Answers are correct D. Guerilla Warfare and Drone Warfare Use the worked example above to help you solve this problem. An Eskimo returning from a successful fishing trip pulls a sled loaded with salmon. The total mass of the sled and salmon is 50.0 kg, and the Eskimo exerts a force on the sled by pulling on the rope. Suppose the coefficient of kinetic friction between the loaded sled and snow is 0.200.(a) The Eskimo pulls the sled 5.90 m, exerting a force of 1.10 102 N at an angle of = 0. Find the work done on the sled by friction, and the net work. Wfric = Correct: Your answer is correct. . J Wnet = Correct: Your answer is correct. . J (b) Repeat the calculation if the applied force is exerted at an angle of = 30.0 with the horizontal. Wfric = J Wnet = J The process of. Produces a new copy of an organisms genetic information which is passed on to a new cell What does it mean to never lose your cargo as it relates to the Underground Railroad? HURRY ASAP Solve the following equation for xa. x=0.5b. x=3C. X=2d. x=1 What is significant about Xian military fortress as it pertains to the Silk Road?I NEED HELP FAST Los pacientes ____ muy enfermos. (Correct form of Estar) An airplane climbs at an angle of 11 decrease with the ground. Find the ground distance it has traveled when it has attained an altitude of 400 ft.A. 2057.82B. 407.49C. 76.32D. 2096.34 Will give Brainliest . a.188.5 cubic unitsb. 204.2 cubic unitsc. 1,021.0 cubic unitsd. 942.5 cubic units