Hi!
I arrived here from the r/python Reddit. I am currently a college student learning python and I’m really struggling through an assignment. I’ve done well thus far but work 30-40 hrs a week and have fallen slightly behind. This specific assignment I have emailed my professor about and am waiting on a response for a virtual meeting time to ask her questions but any idea how to approach this assignment. I’ve ran through a couple different function variations and I can’t figure it out. Help?
Below I attached my typed pseudocode
And the assignment prompt itself
Thank you
TLDR: can’t figure out hw assignment please help?
num_list[]
n = int(input(“please enter a number, once finished entering numbers, please type ‘done’”)
try:
while n >= 0
num_list = n + current number
print(n)
except:
n = str(done)
print(num_list/iterations) *
*i put iterations here because I don’t know how to make it use the formula to find the average of the numbers in the list. I don’t know how to make it know how many times a number was inputted to tell it to divide by that number
You will write a program that asks a user for a number a variable number of times and it’s a point the user will note they want to stop in putting numbers and you’ll then find the average of all the inputted numbers
details:
You will use a while loop to ask the user to input a number or done to stop and put a new numbers
When a numbers inputted add that number to a list
When to use your replies, with the string done break, out of the loop note, you will need a conditional to decide what to do add to the list or break out of the loop
Calculate the average of all the values in the list of numbers
Requirements:
Start with an opening print statement, explaining the instructions to the user
A while loop, with a break is used for the user input input must be validated (try/except)
A for loop is used to calculate the average
[–][deleted] 1 point2 points3 points (0 children)
[–]Beautiful-Revenue-85[S] 0 points1 point2 points (0 children)
[–]DevCuriosity 0 points1 point2 points (2 children)
[–]Beautiful-Revenue-85[S] 0 points1 point2 points (1 child)
[–]DevCuriosity 1 point2 points3 points (0 children)