Question: read in a file named money.txt Write a Python program that will accomplish the following: In a function named average, calculate and display the average
read in a file named" money.txt"
Write a Python program that will accomplish the following: In a function named average, calculate and display the average monthly closing stock prices. In a function named lowest, calculate and display the lowest monthly closing stock price. In a function named highest, calculate and display the highest monthly closing stock price.
def main():
outfile = open("money.txt",'w') for x in range(1): outfile.write(str(money)+' ')
outfile.close()
infile = open("money.txt",'r') money=infile.readlines() print(money)
infile.close()
for x in range(len(money)): money[x]=float(money[x].rstrip(' '))
print(money) average(money) lowest(money) highest(money)
def average(money): total=0 for x in range(len(money)): total += money[x] avg=total / len(money) print("Average freshman GPA=", format(avg,'.2f'))
def lowest(money): smallest = money[x] for x in range(len(students)): if money[x] There are 3 Steps involved in it Get step-by-step solutions from verified subject matter expertsStep by Step Solution
