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
Yuliya22 [10]
3 years ago
13

Write a function maxTemp which takes a filename as string argument and returns the maximum temperature as float type for the wee

k. Input file will contain temperature readings for each day of the week. Your function should read each line from the given filename, parse and process the data, and return the required information. Your function should return the highest temperature for the whole week. Empty lines do not count as entries, and should be ignored. If the input file cannot be opened, return -1. Remember temperature readings can be decimal and negative numbers. Each line of the file contains two elements, separated by commas (,) DAY,TEMPERATURE Monday,52 Note: The split() function is provided, and functions as it does in the homework assignments, to make parsing the output easier. Recall that split takes a string s and splits it at the input delimiter sep, to fill the array words[] up to a capacity of max_words. The return value of split is the number of actual words the string is split into.

Computers and Technology
1 answer:
Alenkinab [10]3 years ago
8 0

Answer:

#section 1

def maxTemp(filename):

   import pathlib

   f = pathlib.Path(filename)

   f.exists()

   if f.exists():

       f = open(filename, "r")

#section 2

       next(f)

       res = [int(sub.split(',')[1]) for sub in f]

       maxdata = (res[0])

       for i in range(len(res)-1):

           if maxdata < res[i]:

               maxdata = res[i]

       

       index = res.index(maxdata)

       f.close()

 #section 3  

       li = []  

       a = open(filename, "r")

       for line in a:

           line = line.strip()

           li.append(line)

   

       

       a.close()

       return (li[index+1])

   else:

       return -1

print(maxTemp("new.csv"))

Explanation:

#section 1:

The function maxTemp is defined. We import pathlib in other to check if the file exists, if it does we carry on with opening the file and if it doesn't the program returns -1.

#section 2:

We start splitting the sub-lists from the second line i.e <em>next(f)</em>. For each line we take the second index element and convert it to an integer.

<em>res = [int(sub.split(',')[1]) for sub in f] </em>

The maximum number is gotten by using the if statement to compare all elements in the list.  The index of the maximum item in the list is collected.

the file is then closed.

#section 3  :

The file is re-opened and all the lines are striped and passed into a new list and the index recovered from section 2, is used to get the day with the highest temperature and the line is returned.

You might be interested in
List and describe the tools for all the main stages of app/application development.
Liono4ka [1.6K]
<span>stuff like -Information Gathering -Planning -Design -Development -Testing and Delivery <span>Maintenance hope that helped.</span></span>
8 0
3 years ago
3. You are a network administrator responsible for all network platforms and services. The Teta Company currently has only one b
solniwko [45]

Answer:

1. Wired networks may give the appearance of a busy office full of the latest equipment, but in reality, wires can be an inefficient networking medium. They can limit signal strength as well as make it more difficult to expand and reorganize your network configuration.  Wireless networking is a viable and affordable alternative that offers the benefits of making your environment more flexible. A wireless infrastructure allows you to effortlessly reconfigure your office space as your company grows and changes, easily extend connectivity and also allows employees to be mobile more easily.

2. Review the advantages and consider the benefits to your organization:

Reduced cost of installation. It may be significantly less expensive to install wireless access points compared to wiring your office with Ethernet capabilities.

Flexibility. If you regularly expand or reorganize your office space, or need to accommodate a variety of network configurations, the rapid transition time from one configuration to another that wireless provides can help reduce your network downtime. In addition, you won't have to incur the costs associated with physically rewiring office space.

Convenient information access. With wireless, you'd have the ability to extend access to key information to anyone on your staff, from anywhere in the office, even when they aren't physically connected to your wired local area network (LAN) connection. Do members of your staff regularly work away from their desks or stations, but could benefit from anytime, anywhere access to important data? Could you improve productivity by increasing access to important company systems? Do you have business processes you could streamline by reducing the number of times employees have to go back to their wired connections?  Wireless LANs are the way to go, especially where there's no existing wired network. This is especially true in leased offices, where you can't go knocking holes in walls.

Your next step is to actually build a wireless LAN, which you'll do just like this:

Identify the equipment you want to buy, such as wireless notebooks, access points, wireless LAN adapters and wireless cards.

Determine the number of users who need to have access to the network. This will help you determine the number of access points you'll need.

Plan for the connection to your wired LAN, probably in a central location and in an open environment. Your goal is to maximize the access point's wireless range. The quoted range is a maximum of 300 feet, but that's very dependent on the existing environment--walls, water pipes, cables and so on all could decrease the range. The best thing to do is complete a site survey first; if that's not possible, assume a maximum range of 150 feet, as 300 could decrease throughput.

8 0
3 years ago
Read 2 more answers
The first screen you see when you open word2016 what is called?​
expeople1 [14]
The correct answer is: Recent Screen
7 0
3 years ago
Read 2 more answers
Which of the following is true of standard error? a. It can take negative values. b. It is an estimate of the standard deviation
madreJ [45]

Answer:b. It is an estimate of the standard deviation

Explanation:

4 0
3 years ago
A group of computers that are interconnected in order to share information or documents is called a _____.
Alisiya [41]

Answer:

Computer Network.

Explanation:

Hope this helped you! <3

6 0
3 years ago
Other questions:
  • What does iSCSI stand for?
    5·2 answers
  • Universal Containers recently rolled out a Lightning Knowledge implementation; however, users are finding unreliable and unrelat
    6·1 answer
  • )1-bit sign, 8-bit exponent, 23-bit fraction and a bias of127 is used for ___________ Binary Floating PointRepresentation
    11·1 answer
  • 23. For the 16-bit binary number 1001 0101 1100 0011, show the effect of: a. A right shift of 4 bits with zero fill. b. A right
    13·2 answers
  • Websites that group individuals and organizations into clusters or groups based on some sort are considered to be what type of n
    11·1 answer
  • Suppose you are given a data set consisting of nominal attributes, such as color, which takes values such as red, blue, green et
    9·1 answer
  • What is the traditional cognitive perspective ofHCL?
    12·1 answer
  • Write a program to complete the task given below: Ask the user to enter any 2 numbers in between 1-10 and add both of them to an
    8·1 answer
  • It is possible to change the shape of a text box.
    10·1 answer
  • Which of the following statements is NOT true about url extension?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!