Question

Write a phython program that accepts six (6) daily temperatures, in Fahrenheit, for a typical October...

Write a phython program that accepts six (6) daily temperatures, in Fahrenheit, for a typical October day this year. The program should also request the town or city and state names of where these temperatures were recorded in. The program should determine the average temperature of this ‘typical’ day then calculate the average October daily temperature in five years assuming that the temperature will rise by a total of 4.5% in those five years. The program will print in a whole sentence the estimated average temperature for the town/city and state involved.

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

Python Program:

""" Python program that reads SIX daily temperatures and prints the estimated average temperature """

# Reading town or city name
town = input("Enter town or city name: ")

# Reading state name
state = input("Enter state name: ")

# Reading six temperature values
temperatures = []
print("Enter six daily temperatures, in Fahrenheit, for a typical October day this year: ")

# Looping for six times
for i in range(6):
   temperatures.append(float(input()))
  
# Calculating current average
currAvg = sum(temperatures) / len(temperatures)  

# Calculating temperature that will rise by a total of 4.5%
futureAvg = ( sum(temperatures) + ( sum(temperatures) * (4.5/100.0) ) ) / len(temperatures)  

# Printing result
print("\n Current average temperature for the " + town + " and state " + state + " is " + str(currAvg) + " \n")
print("\n Estimated average temperature for the " + town + " and state " + state + " is " + str(futureAvg) + " \n")

_______________________________________________________________________________________________________

Sample Run:

______________________________________________________________________________________________________

Code Screenshot:

Add a comment
Know the answer?
Add Answer to:
Write a phython program that accepts six (6) daily temperatures, in Fahrenheit, for a typical October...
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
  • Assume that, for a given town, mid-day daily temperature in Fahrenheit was measured for a month...

    Assume that, for a given town, mid-day daily temperature in Fahrenheit was measured for a month and stored in a file called temperature.txt. Write a complete C Language program that reads the stored temperatures, one at a time, from the file temperature.txt and converts the read temperature to its equivalent in Celsius. Your program should store each converted temperature in an output file called results.txt. Your program should find the average, the minimum, and the maximum temperatures in Celsius and...

  • Assume that, for a given town, mid-day daily temperature in Fahrenheit was measured for a month...

    Assume that, for a given town, mid-day daily temperature in Fahrenheit was measured for a month and stored in a file called temperature.txt. Write a complete C language program that reads the stored temperatures, one at a time, from the file temperature.txt and converts the read temperature to its equivalent in Celsius. Your program should store each converted temperature in an output file called results.txt. Your program should also find the average, the minimum, and the maximum temperatures in Celsius...

  • Temperatures in LA. The average daily high temperature in October in Los Angeles is 79 degrees...

    Temperatures in LA. The average daily high temperature in October in Los Angeles is 79 degrees Fahrenheit with a standard deviation of 5 degrees Fahrenheit. Suppose that the temperatures in October closely follow a normal distribution. Round calculated answers to 3 decimal places. 1. What is the probability of observing an 78 degrees Fahrenheit temperature or higher in Los Angeles during a randomly chosen day in October? 2. How cold are the coldest 30% of the days during October in...

  • Develop a Java program that will store data in the form of daily average temperatures for...

    Develop a Java program that will store data in the form of daily average temperatures for one week. Store the day and average temperature in two different arraylists. Your program should prompt the user for the day of the week (Monday through Sunday) and display both the day and temperature for each day. If “week” is entered, the output for your program should provide the temperature for each day and the weekly average. Use the looping and decision constructs in...

  • You can vary it as long as the fahr and cels temperatures line up vertically and everything is clearly labeled. This program involves inputting a set of Fahrenheit temperatures and performing a set...

    You can vary it as long as the fahr and cels temperatures line up vertically and everything is clearly labeled. This program involves inputting a set of Fahrenheit temperatures and performing a set of operations on them: The number of temperatures to input is determined by the user at the beginning of the program. You must ask them to enter the number of temperatures that they will be typing in. This number must be between 1 and 30 (inclusive.) If...

  • 1. Write a C++ program that reads daily weather observation data from a file and writes...

    1. Write a C++ program that reads daily weather observation data from a file and writes monthly and annual summaries of the daily data to a file. a. The daily weather data will be contained in a file named wx_data.txt, with each line of the file representing the weather data for a single day. b. For each day, the date, precipitation amount, maximum temperature, and minimum temperature will be provided as tab-separated data with the following format: 20180101 0.02 37...

  • Using Embadded C programing Write a program to process a collection of daily high temperatures. Your...

    Using Embadded C programing Write a program to process a collection of daily high temperatures. Your program should count the number of hot days (high temperature 85 or higher), the number of pleasant days (high temperature 60–84), and the number of cold days (high temperatures less than 60). Test your program on the following data: 55 62 68 74 59 45 41 58 60 67 65 78 82 88 91 92 90 93 87 80 78 79 72 68 61...

  • (use filename system: lastname_tempdata_firstinitial.m) 1. Gilat Chapter 6 Chapter7 #6. Use a single M-file and use...

    (use filename system: lastname_tempdata_firstinitial.m) 1. Gilat Chapter 6 Chapter7 #6. Use a single M-file and use mnemonic variable names of 3 characters or more for the variables to complete the problem. This is a comparison problem. If, selection, statements are not required but may be used. Loops are not required but may be used. Do not add any user defined M-files for this problem. Use fprintf statements to show the answer to each scenario: a), b), c), d), e) Investigate...

  • Write a program that demonstrates use of programmer - defined data structures. Please provide code! Thank...

    Write a program that demonstrates use of programmer - defined data structures. Please provide code! Thank you. Here are the temps given: January 47 36 February 51 37 March 57 39 April 62 43 May 69 48 June 73 52 July 81 56 August 83 57 September 81 52 October 64 46 November 52 41 December 45 35 Janual line Iranin Note: This program is similar to another recently assigned program, except that it uses struct and an array of...

  • C++ Objective: Write a program to read a pre-specified file containing salespersons' names and daily sales...

    C++ Objective: Write a program to read a pre-specified file containing salespersons' names and daily sales for some number of weeks. It will create an output file with a file name you have gotten from the user that will hold a summary of sales data. Specifications: 1. You should do a functional decomposition to identify the functions that you will use in the program. These should include reading and writing the files, tallying and showing statistics, etc. 2. The program...

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