1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Romashka-Z-Leto [24]
3 years ago
15

Create a function average_temp(s) that accepts a file name s that contains temperature readings. Each line in the file contains

a date followed by 24 hourly temperature readings in a comma-separated-value format, like this example:
2/3/2016,18,17,17,18,20,22,25,30,32,32,32,33,31,28,26,26,25,22,20,20,19,18,18,18

For each line in the file, the function should print out a line containing two items: the date, then comma, then the average temperature on that date, e.g.

3/5/2018, 58.24

3/6/2018, 60.11

3/7/2018, 57.55
Computers and Technology
1 answer:
Debora [2.8K]3 years ago
3 0

Answer:

def average_temp(s): f = open("s.txt","r") for line in f: myList = line.split(",") print(myList[0],end=",") t=0 for i in range(1,25,1): t += int(myList[i]) t /= 24 print(t) f.close()

def average_temp(s):

f = open("s.txt","r")

for line in f:

myList = line.split(",")

print(myList[0],end=",")

t=0

for i in range(1,25,1):

t += int(myList[i])

t /= 24

print(t)

f.close()

Explanation:

I used Python for the solution.

You might be interested in
Graphic software task​
seraphim [82]

Answer:

Graphic Designers

ProofHub as Project Management Tool. ProofHub is a versatile project management software for designers. ...

Jira. ...

Kanbanize. ...

Trello as Project Management Software for Graphic Designers. ...

Basecamp as Tool for Project Management. ...

Podio. ...

Asana. ...

Dropbox.

More items...•

7 0
3 years ago
Consider the following statements: #include #include class Temporary { private: string description; double first; double second;
Anna007 [38]

#include <iostream>  

#include <iomanip>  

using namespace std;  

class temporary  

{  

public:  

void set(string, double, double);  

void print();  

double manipulate ();  

void get (string&, double&, double&);  

void setDescription(string);  

void setFirst(double);  

void setSecond(double);  

string getDescription() const;  

double getFirst () const;  

double getSecond () const;  

temporary(string = "", double = 0.0, double = 0.0);  

private:  

string description;  

double first;  

double second;  

};  

void temporary::set(string a, double dblA, double dblB)  

{  

description = a;  

first = dblA;  

second = dblB;  

}  

void temporary::print()  

{  

cout << "\nDescription: " << left << setw(20) << description << endl <<  

" first: " << fixed << setw(10) << setprecision(2) << first << endl <<  

" second: " << fixed << setw(10) << setprecision(2) << second << endl;  

}  

double temporary::manipulate()  

{  

return first / 3.0 + second / 4.0;  

}  

void temporary::get(string& strDesc, double& dblFirst, double& dblSecond)  

{  

strDesc = description;  

dblFirst = first;  

dblSecond = second;  

}  

temporary::temporary(string d, double a, double b) : description(d), first(a), second(b) {}  

void temporary::setFirst(double dblFirst){first = dblFirst;}  

void temporary::setSecond(double dblSecond){second = dblSecond;}  

void temporary::setDescription(string desc){description = desc;}  

string temporary::getDescription() const {return description;}  

double temporary::getFirst () const{return first;}  

double temporary::getSecond () const {return second;}  

int main()  

{  

cout << "temporary a;";  

temporary a;  

a.print();  

cout << "a.setFirst(3.0): ";  

a.setFirst(3.0);  

a.print();  

cout << "a.setSecond(4.5): ";  

a.setSecond(4.5);  

a.print();  

cout << "a.setDescription(\"Picture Frame\") ";  

a.setDescription("Picture Frame");  

a.print();  

cout << "a.print(): ";  

a.print();  

return 0;  

}

6 0
3 years ago
Mateo could not find the undo command or shortcut. He should _____.
mr Goodwill [35]
Mateo should click on help.
5 0
3 years ago
Read 2 more answers
Why do Linux administrators prefer to give sudo access to application teams instead of letting them su to root?
likoan [24]

Answer:

Explanation:

some distros like ubuntu do not even allow su to switch to root. furthermore the su to root is dangerous because the user becomes the all-powerful administrative account, so no warnings are issued if the application team user tries to do something system-breaking.

8 0
1 year ago
What is the process viewing files in chrome web browser cache?
Andreyy89

Step 1. Click the address bar at the top of your Google Chrome window, type "About: cache" into the box and press "Enter." A page will appear with a list of cached files and their addresses.

Step 2. Press the "Ctrl" and "F" keys on your keyboard at the same time to open the find bar.

Step 3. Type part of the name or address of a cached file into the find box and press "Enter" to find it. Continue pressing "Enter" to page through any matching results.

Step 4. Select the full address of the cached file on the page with your mouse and press "Ctrl" and "C" at the same time to copy the address.

Step 5. Click the address bar, press "Ctrl" and "V" at the same time to paste the address and press "Enter" to load the file. Chrome loads the file from the cache.

Step 6. Right-click the image, page or script and select "Save As" to save the cached file to your computer.

6 0
2 years ago
Other questions:
  • A type of touch screen that can be up to four feet by six feet is a(n) _____. plasma screen multitouch interface Electronic Pape
    10·2 answers
  • What's the 16-bit hexadecimal representation of the signed decimal integer, -331? Answeers?
    14·1 answer
  • Tiffany is an instructor at a college that is run on student tuition and not state taxes. Which statement best describes her emp
    6·2 answers
  • Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than
    7·1 answer
  • Which speaker port should you use when connecting a single speaker to a pc?
    6·1 answer
  • You recently discovered that Marketing1 can connect to Admin1, and Admin1 can connect to Marketing1, but neither of these comput
    11·1 answer
  • Advertising is organized around four distinct groups. The _____ group includes the photographers, the illustrators, video produc
    9·1 answer
  • While surfing online, Patricia checks her email and reads the latest messages. She then browsers a website and logs in a comment
    8·1 answer
  • Why did Elena Gilbert Turn her humanity off when she was sired to Damon? (In The Vampire Diaries)
    14·1 answer
  • Draw a conceptual sketch of your laptop. Identify the keyboard, screen, power source, and storage device and etc. using arrows a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!