Question

In: Computer Science

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 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.. The program should include the pseudocode used for your design in the comments. Document the values you chose for the thresholds in your comments as well. Please provide a test report. In the test report document, please provide detailed explanation on the input, expected output, and actual output.

Solutions

Expert Solution

  • Code:-

celsius = []
fahrenheit = []
cool = 0
hot = 0
warm = 0

#read input temp from user and append themp to celcius list
#convert given temp to fahrenheit and append it to fahrenheit list
#based on temp in celcius count cool warm and hot days
for i in range(0,10):
    temp = float(input("Enter temperature in celcius for day {}: ".format(i)))
    celsius.append(temp)
    temp_f = (temp * 1.8) + 32
    fahrenheit.append(temp_f)
    #We Consider below 15°C - Cool
    #We Consider 16 to 28°C - Warm
    #We Consider above 28°C - Hot
    if(temp<=15):
        cool+=1
    elif(temp<=28):
        warm+=1
    else:
        hot+=1

#print results
print("The temperatures for ten consecutive days in Celsius {}".format(celsius))
print("The temperatures for ten consecutive days in fahrenheit {}".format(fahrenheit))
print("The number of cool days are {}".format(cool))
print("The number of warm days are {}".format(warm))
print("The number of hot days are {}".format(hot))

  • Output:-

  • Test Report:-
  • Input:-
  • Here, in the above program we will give input as Celcius and first we will convert that into Fahrenheit and those are stored in an array and we will display both celcius and fahrenheit reports which are stored in an array.
  • and according to the threshold values we have given we will categorize those days into warm, cool, and hot.
  • Expected Output:-
  • Expected Output will have celcius we gave and fahrenheit it converts and days we categorize it into.

  • Actual Output:-
  • In the Actual Output, we have the things what we have expected from the program to compute.
  • and Here also we have same things like, celcius, fahrenheit information along with the days we categorize.
  • Note:- Here, There is no error in the program I re-verified the program and re-typed the code. please try to see the code in laptop or pc screen...!
  • Mobile screen will gave you the indentation errors. please try to understand...!

Thank You...!


Related Solutions

This involves writing a Python program to determine the body-mass index of a collection of six...
This involves writing a Python program to determine the body-mass index of a collection of six individuals. Your program should include a list of six names. Using a for loop, it should successively prompt the user for the height in inches and weight in pounds of each individual. Each prompt should include the name of the individual whose height and weight is to be input. It should call a function that accepts the height and weight as parameters and returns...
For Python: In this assignment you are asked to write a Python program to determine the...
For Python: In this assignment you are asked to write a Python program to determine the Academic Standing of a studentbased on their CGPA. The program should do the following: Prompt the user to enter his name. Prompt the user to enter his major. Prompt the user to enter grades for 3 subjects (A, B, C, D, F). Calculate the CGPA of the student. To calculate CGPA use the formula: CGPA = (quality points * credit hours) / credit hours...
In Python This assignment involves the use of text files, lists, and exception handling and is...
In Python This assignment involves the use of text files, lists, and exception handling and is a continuation of the baby file assignment. You should now have two files … one called boynames2014.txt and one called girlnames2014.txt - each containing the top 100 names for each gender from 2014. Write a program which allows the user to search your files for a boy or girl name and display where that name ranked in 2014. For example … >>>   Enter gender...
in python You will be writing a program that can be used to sum up and...
in python You will be writing a program that can be used to sum up and report lab scores. Your program must allow a user to enter points values for the four parts of the problem solving process (0-5 points for each step), the code (0-20 points), and 3 partner ratings (0-10) points each. It should sum the points for each problem-solving step, the code, and the average of the three partner ratings and print out a string reporting the...
This project involves writing a program to calculate the terms of the following sequence of numbers:...
This project involves writing a program to calculate the terms of the following sequence of numbers: 0 1 1 3 5 11 21 43 … where each term is twice the second previous term plus the previous term. The 0th term of the sequence is 0 and the 1st term of the sequence is 1. The example below shows how to calculate the next sequence term: Current sequence: 0 1 Calculate next term: 2 * 0 + 1 = 1...
Python Assignment You will be writing an inventory system that is backed by JSON data and...
Python Assignment You will be writing an inventory system that is backed by JSON data and will be working with a starter file that contains a JSON string. The code you write will need to follow the following guidelines. The what You’re at work one day and your boss asks you about that fancy programming language you’ve been learning, Python. She asks you if you can use it to read JSON data from a supplier and build an inventory. “Of...
python fill in these questions--- 1. Examine target_map.txt. Write a Python program that will read this...
python fill in these questions--- 1. Examine target_map.txt. Write a Python program that will read this file, then compute and display the number of targets (#). Copy your Python program below: target_map.txt S##............................. ..#............................. ...######.........##########.... ........#..................#.... ........#.................#..... ........#####.......######...... ............#......#............ ............#.......#........... ............#.......#........... ......#######.......#........... ......#.............#........... ......#..............###........ ......#................#........ .......#...............#........ ........#...............#....... .........#.......#......#....... .........#..............#....... ............#...........#....... ............#...#.......#....... ............#...#........#...... ............#...#.........#..... ............#...#.........#..... ............#..........#........ ............#..............#.... ...##..#####....#..........#.... .#..............#...........#... .#..............#...........#... .#......#######............#.... .#.....#................#....... .......#................#....... ..####.........#.....#.......... ................######..........
In python make a simple code. You are writing a code for a program that converts...
In python make a simple code. You are writing a code for a program that converts Celsius and Fahrenheit degrees together. The program should first ask the user in which unit they are entering the temperature degree (c or C for Celcius, and f or F for Fahrenheit). Then it should ask for the temperature and call the proper function to do the conversion and display the result in another unit. It should display the result with a proper message....
For this Assignment, read the passages provided and compare the original passages to the student writing...
For this Assignment, read the passages provided and compare the original passages to the student writing samples. Passage 1: Reference: O’Conner, P. (2003). Woe is I: The grammarphobe’s guide to better English in plain English. New York, NY: Riverhead Books. A good writer is one you can read without breaking a sweat. If you want a workout, you don’t lift a book—you lift weights. Yet we’re brainwashed to believe that the more brilliant the writer, the tougher the going. The...
Assignment 1 – Writing a Linux Utility Program Instructions For this programming assignment you are going...
Assignment 1 – Writing a Linux Utility Program Instructions For this programming assignment you are going to implement a simple C version of the UNIX cat program called lolcat. The cat program allows you to display the contents of one or more text files. The lolcat program will only display one file. The correct usage of your program should be to execute it on the command line with a single command line argument consisting of the name you want to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT