Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
instruction refused on a "while loop"
1. assign user input to variable (str)
2. check the user input. if it is THAT specific value you want to use for quit - then use break to exit the loop
3. if it is not p.2 - convert to number and calculate
4. Also why you set size = 40 and never use it. think what condition should you use in the while statement.
Here is the solution of my problem using error handling. I hope the code will be tagged. Here is the code:::::::::::::::::::::::::::
size = 40
print("here is the addition of many numbers (even with a .) Maximum of numbers=", size)
print("Once you have finished your list of numbers, just press $ to indicate the end\n")
total = 0.0
value = 0.0
count = 1
while (count != 0):
        value = float(input("enter the value: "))
    except ValueError:
            average = total/count
            print("average value= ", average)
        total = value + total
        count = count + 1

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Nginx Uwsgi Django 111 Connection refused while connecting to upstream sandyman 0 41 Sep-18-2017, 07:05 AM
Last Post: sandyman

Forum Jump:

Users browsing this thread: 1 Guest(s)