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.
The suspense and reaction time of the car . So for example if a car pulled out suddenly and was about to hit you, you could make the car so it functionally knows how to react
Answer:
Explanation:
The internet could be regarded has a marketplace or platform which gives individuals, businesses the opportunity to interact, relate, access opportunities, learn in an easy manner with the help of a data connection. The internet has redefined the process and concept of acesing information and interaction with the ease and coverage it brings. The Social media is could be seen a part of the internet platform which allows people to relate and interact, make friends, promote brands and so on. The internet and social media platforms however, in spite of its huge benefits comes with its inherent risk. Including the surge in cyber crime, immorality and information theft to mention a few. Common scenarios whereby banking details are being stolen from databases resulting in wholesale illegal transfer of funds. Issues of blackmail and violent defamation by groups of cohorts has also been a con in the advent of internet and social media, including growing trends of fake news which usually escalate tension, in which the recent unrest in my vicinity benefitted negatively from.
Answer:
Explanation:
A ruler
;););););););););););););););)
Answer:
The output is: Your cost is 100
Explanation:
Given
The above code snippet
and

Required
Determine the output of the code
if cost < 70 or cost > 150
The above condition checks if cost is less than 70 or cost is greater than 150
This condition is false because 100 is neither less than 70 nor is it greater than 150
So, the else statement will be executed.
discount = cost
Which means
discount = 100
So, the print instruction will print: Your cost is 100