Question

2877 How many days does it take to reach 6 inches of accumulated rainfall in Knoxville?...

2877 How many days does it take to reach 6 inches of accumulated rainfall in Knoxville? Assume the variable DAILY_RAIN is defined and is a row vector of a list of values containing the daily rainfall amounts, in inches, for Knoxville. Write a code segment to determine the number of days (values) until the sum is at least 6 inches of accumulated rainfall and store that value in the variable DAYS. Hints: Use a "loop" to sum the values in the input vector, chronologically, adding one more value each time

Example test case: Given an input vector DAILY_RAIN=[1.1 0.9 1.5 1.5 1.2 0.4 0.3] should result in DAYS=5 (1.1 + 0.9 + 1.5 + 1.5 + 1.2 = 6.2 >=6)

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

#python programming language
DAILY_RAIN=[1.1, 0.9, 1.5, 1.5, 1.2, 0.4, 0.3]   #row vector of list of values containing daily rainfall
number_of_days = 0
flag = 0
Total_rain = 0
for i in DAILY_RAIN:   # loop through all elements in row vector
    Total_rain += i     # and add them to Total_rain
    number_of_days += 1 # increment the number of days passed
    if Total_rain >= 6:   # condition check for total rain more than 6 inches
        flag = 1         # If condition true, It is possible to accumulate 6 or more inches of rain
        break            # Break out of the loop
if flag == 1:
    print("DAYS = ",number_of_days)
else:
    print("Cannot accumulate required rain")

Add a comment
Know the answer?
Add Answer to:
2877 How many days does it take to reach 6 inches of accumulated rainfall in Knoxville?...
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
  • how might i show a change from 60 days worth of inventory to 30 days worth...

    how might i show a change from 60 days worth of inventory to 30 days worth in this financial statement? The goal is to show how it affects the year end notes payable, but what numbers would i change? -2.0 Clipboard UPDATES AVAILABLE Updates for Office are ready to be installed, but first we need to does X f o C501047 048-049 B C D E LMNOPI Depreciation (4) 0.9 0.9 0.9 0.9 1.0 10.7 Interest Expense (5) 0.6 0.4...

  • Autocorrelation of an X(t) random process is Rxx (t1, t2) = 4e-t-t2 This a Gaussian process...

    Autocorrelation of an X(t) random process is Rxx (t1, t2) = 4e-t-t2 This a Gaussian process with mean zero. a) [6p] Is this process wide sense stationary? Briefly explain. b) [9p] Calculate the probability P (X(2)> 1) using the Table at the cover. c) [10p] Calculate approximately the probability P(X(2) > X(4) + 1). Some useful relations 1. Var(X(t)) = E({€)) - (E(X(t))) 2. R(X(t)X(t) = ELX(t-)X(02)]| 3. Var(X(c) +X)) = Var( (t) ) + Var (X (t2) - 2Cov(X...

  • Trans-Pacific Industry & Technology Company Trans-Pacific Industry & Technology (TPIT), Inc. is a diversified industrial company....

    Trans-Pacific Industry & Technology Company Trans-Pacific Industry & Technology (TPIT), Inc. is a diversified industrial company. The Company owns businesses providing products & services to the energy, transportation, chemical, and construction sectors. The energy segment operates as an oil and natural gas contract drilling company the United States. The energy segment acquires, explores, develops, and produces oil and natural gas properties primarily located in Oklahoma and Texas, as well as in Arkansas, Colorado, Kansas, Louisiana, Mississippi, Montana, New Mexico, North...

  • assignment 1a-d in Python. please explain your steps, thanks in advance. This is the only information...

    assignment 1a-d in Python. please explain your steps, thanks in advance. This is the only information that we got for this practice exercise, my teacher said that we should try to get the output literally as in the example. Assignment 1 (a: 1 point; b: 1 point; c: 2 points; d: 2 points) Your goal is to implement functions fac(n), cos1(x, n) and cos2 (x, n) and a small test program in the file A1.py and to test the functions...

  • Coding in C++ Write a program using structures to store the following weather information: - Month...

    Coding in C++ Write a program using structures to store the following weather information: - Month name - Day of month (Monday, Tuesday, etc) - High Temperature - Low Temperature - Rainfall for the day Use an the input.txt file to load the data into weather structures. Once the data for all the days is entered, the program should calculate and display the: - Total rainfall for the data - Average daily temperatures. (note: you'll need to calculate the days...

  • Let X be a normal random variable with mean 4 and variance 9. Use the normal...

    Let X be a normal random variable with mean 4 and variance 9. Use the normal table to find the following probabilities, to an accuracy of 4 decimal places. Normal Table The entries in this table provide the numerical values of Φ(z)=P(Z≤z), where Z is a standard normal random variable, for z between 0 and 3.49.For example, to find Φ(1.71), we look at the row corresponding to 1.7 and the column corresponding to 0.01, so that Φ(1.71)=.9564. When z is...

  • t-Distribution Table Find the critical value t, for the confidence level c0 80 and sample size...

    t-Distribution Table Find the critical value t, for the confidence level c0 80 and sample size n 9 Click the icon to view the t-distribution table. (Round to the nearest thousandth as needed ) Level of confidence, c 0.80 0.90 0.95 0.98 0.9 One tall a 0.10 0.05 0.025 0.01 0.05 d. Two talls, α 0.20 0.10 005 002 001 du 3.078 6 314 12.706 31.821 63.657 1886 2920 4303 6965 9925 2 638 2.353 3.182 4541 5.841 1.533 2.132...

  • Accounting for Business Decisions – Starbucks You are to submit an individual one to two-page report...

    Accounting for Business Decisions – Starbucks You are to submit an individual one to two-page report answering the following from an accounting perspective, not a marketing/management perspective: You are required to: 1. Of all the risks (risks are listed at the bottom) that Starbuck’s management discloses, which one do you think could most adversely affect the Balance Sheet and Income Statement at the store level and why? Demonstrate your understanding by showing an effect one on at least one of...

  • JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per...

    JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per Share Amounts) (Note 1)* 2016 71,890 21,789 50.101 20,067 9.143 29 Sales to customers Cost of products sold Gross profit Selling, marketing and administrative expenses Research and development expense In-process research and development Interest income Interest expense, net of portion capitalized (Note 4) Other (income) expense, net Restructuring (Note 22) Eamings before provision for taxes on income Provision for taxes on income (Note 8)...

  • JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per...

    JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per Share Amounts) (Note 1)* 2016 71,890 21,789 50.101 20,067 9.143 29 Sales to customers Cost of products sold Gross profit Selling, marketing and administrative expenses Research and development expense In-process research and development Interest income Interest expense, net of portion capitalized (Note 4) Other (income) expense, net Restructuring (Note 22) Eamings before provision for taxes on income Provision for taxes on income (Note 8)...

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