Finding average of numbers excluding -1

50 Views Asked by At

Write a program that continually asks the user to enter a number.

  • When the user enters “-1”, the program should stop requesting the user to enter a number,
  • The program must then calculate the average of the numbers entered, excluding the -1.
  • Make use of the while loop repetition structure to implement the program.

What I have done so far is the first part. Struggling with second part

random_num = 0

while True:
    print(random_num)

    random_num = input("enter a number: ")
    if random_num == "-1":
        break
0

There are 0 best solutions below