Paste
Of Code


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
FILE_NAME = 'Numbers.txt'


def main():
    input_file = open(FILE_NAME, 'r')

    num_of_numbers = 0

    total = 0

    max_number = 0

    min_number = float(input_file.readline().rstrip())

    for number in input_file:

        if number.find('\n'):

            num_of_numbers += 1

        number = number.rstrip()

        number = float(number)

        if number > max_number:

            max_number = number

        if number < min_number:

            min_number = number

        total += number

    average = total / num_of_numbers


    print(total)
    print(num_of_numbers)
    print(average)
    print(min_number)
    print(max_number)
        

main()

Toggle: theme, font