The following code to run as the described program on python. The extra test file isn't included here, assume it is a text file named "TXT" with a series of numbers for this purpose.
In this lab you will need to take a test file
Your program must include:
Code
def fileoperations():
fname=input("First Name")
lname=input("Last name")
file1 = open('TXT', 'r')
Lines = file1.readlines()
myList=[]
count=0
total=0
for line in Lines:
myList.append(int(line))
count+=1
total+=int(line)
print ("Elements in the file: " + str(myList))
print("TOTAL: " + str(total) + " MAX: " + str(max(myList)) + " MIN: " + str(min(myList)) + " Count: " + str(count))
print ("Thank you " + fname + " " + lname +" for using the program." )
fileoperations()
Output
Get Answers For Free
Most questions answered within 1 hours.