Question

In: Computer Science

Design a Python program to prompt the user for temperatures for ten consecutive days in Celsius...

Design a Python program to prompt the user for temperatures for ten consecutive days in Celsius and store them into an array. The entire array should then be displayed. Next each temperature in the array should be converted to Fahrenheit and stored into a 2nd array. This entire array should then be displayed. The formula for converting Celsius to Fahrenheit is °F = (°C × 1.8) + 32. Finally, the number of cool, warm and hot days should be counted and the number of each type of days should be displayed. You should decide on the thresholds for determining whether a day is cool, warm or hot. Document the values you chose for the thresholds in your comments as well.

Solutions

Expert Solution

code and output

Code for copying

t=list(map(float,input("Enter the temparature: ").rstrip().split()))
list2=[]
for i in t:
list2.append((i*1.8)+32)
print(list2)
cool_days=0
warm_days=0
hot_days=0
for i in list2:
if i<60: #temparatures lesss than 60 F are cool days
cool_days+=1
if 60<=i<=100: #temparatures greater than 60 F and less than 100F are warm days
warm_days+=1
if 100<i: #temparatures greater than 100F are Hot days
hot_days+=1
print("cool days = {}".format(cool_days))
print("warm days = {}".format(warm_days))
print("hot days = {}".format(hot_days))

Code snippet

t=list(map(float,input("Enter the temparature: ").rstrip().split()))
list2=[]
for i in t:
    list2.append((i*1.8)+32)
print(list2)
cool_days=0
warm_days=0
hot_days=0
for i in list2:
    if i<60:    #temparatures lesss than 60 F are cool days
        cool_days+=1 
    if 60<=i<=100:  #temparatures greater than 60 F and less than 100F are warm days
        warm_days+=1
    if 100<i:   #temparatures greater than 100F are Hot days
        hot_days+=1 
print("cool days = {}".format(cool_days))
print("warm days = {}".format(warm_days))
print("hot days = {}".format(hot_days))

Related Solutions

Write a Python program to read in the temperatures for ten consecutive days in Celsius and...
Write a Python program to read in the temperatures for ten consecutive days in Celsius and store them into an array. The entire array should then be displayed. Next each temperature in the array should be converted to Fahrenheit and the entire array should be again be displayed. The formula for converting Celsius to Fahrenheit is °F = (°C × 1.8) + 32. Finally, the number of cool, warm and hot days should be counted and the number of each...
The sixth assignment involves writing a Python program to read in the temperatures for ten consecutive...
The sixth assignment involves writing a Python program to read in the temperatures for ten consecutive days in Celsius and store them into an array. The entire array should then be displayed. Next each temperature in the array should be converted to Fahrenheit and the entire array should be again be displayed. The formula for converting Celsius to Fahrenheit is °F = (°C × 1.8) + 32. Finally, the number of cool, warm and hot days should be counted and...
In Python, your program will read in a number (no need to prompt the user), and...
In Python, your program will read in a number (no need to prompt the user), and then reads in that number of lines from the terminal. Then the program should print an array of strings formatted in a nice regular box. So if the user inputs this: 5 Grim visaged war has smooth’d his wrinkled front And now, instead of mounting barded steeds To fright the souls of fearful adversaries He capers nimbly in a lady’s chamber To the lascivious...
Create a python program that will: prompt a user for a command Command get_data Level 1:...
Create a python program that will: prompt a user for a command Command get_data Level 1: Take one of the commands my_max my_min my_range my_sum mean median mode fib factorize prime Requirements: Your commands should be case-insensitive You should use python lists to store data You should NOT use built-in python math functions, or math libraries to compute these values Tips: Write one function that will convert a string with comma-separated numbers into a python list with the numbers. You...
*** Using Python *** Your program must prompt the user for their city or zip code...
*** Using Python *** Your program must prompt the user for their city or zip code and request weather forecast data from openweathermap.org. Your program must display the weather information in an READABLE format to the user. Requirements: Create a Python Application which asks the user for their zip code or city. Use the zip code or city name in order to obtain weather forecast data from: http://openweathermap.org/ Display the weather forecast in a readable format to the user. Use...
Number Analysis Program (Specific Design Specifications) Design a Python program that asks the user to enter...
Number Analysis Program (Specific Design Specifications) Design a Python program that asks the user to enter a series of 20 numbers. The program should store the numbers in a list then display the following data: The lowest number in the list The highest number in the list The total of the numbers in the list The average of the numbers in the list This python program must include the following functions. Your program must use the exact names, parameter lists,...
Write a python program that will ask the user to enter any number of days. The...
Write a python program that will ask the user to enter any number of days. The program reads the number of days from the user, and returns how many years, months, and days are there in the given number of days. Your program should prompt the user to: Enter the number of days : 1152 The user types number of days (1152 above, for example) and hit enter key. The program then will print: 3 years 1 months 27 days...
Q#3 Write a C++ program to read 10 temperatures in Celsius and to store the temperatures...
Q#3 Write a C++ program to read 10 temperatures in Celsius and to store the temperatures in an array of integers, then it should convert the temperatures to Fahrenheit and store the new values rounded to the nearest integer in another array . The program should display both temperatures in a table form.    F = 9/5 x C + 32 where F is temp in Fahrenheit and C temperature in Celsius
Python Code: Write a program to prompt the user to enter a first name, last name,...
Python Code: Write a program to prompt the user to enter a first name, last name, student ID, number of hours completed and GPA for 5 students. Use a loop to accept the data listed below. Save the records in a text file. Write a second program that reads the records from your new text file, then determines if the student qualifies for Dean’s list or probation. Display the records read from the file on screen with appropriate headings above...
Write a design algorithm and a python program which asks the user for the length of...
Write a design algorithm and a python program which asks the user for the length of the three sides of two triangles. It should compute the perimeter of the two triangles and display it. It should also display which triangle has the greater perimeter. If both have the same perimeter it should display that the perimeters are the same. Formula: Perimeter of triangleA = (side1A + side2A +side3A) See the 2 sample outputs. Enter side1 of TriangleA: 2 Enter side2...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT