Even though I get the same desired output, the autograder fails in exercise no. 5.2 and gives the following error:
“Error storing grade on server”
Please,
can you explain?
Even though I get the same desired output, the autograder fails in exercise no. 5.2 and gives the following error:
“Error storing grade on server”
Please,
Please post your actual code and a link to the project instead of a picture. Thanks
largest = None
smallest = None
while True:
num_str = input("Enter a number: ")
if num_str == "done":
break
try:
num = int(num_str)
except:
print("Invalid input")
#print(num)
if largest == None or smallest == None:
largest = num
smallest = num
elif largest < num:
largest = num
elif smallest > num:
smallest = num
print("Maximum is", largest)
print("Minimum is", smallest)
Thanks for the code. Where are you running it?
Given the name of the error, it would seem highly likely there’s a server side issue, rather than an issue with your code. I also reviewed your code and saw that it it correct. Have you tried again at a later time? Perhaps the server was updating or going through a power cycle.
if the input is invalid, your code will go through the if/elif chain, is it possible that largest
and smallest
could become invalid values?
I don’t think so, because running the program, when I enter an invalid input, like “bob”, the program return to the input query again. Check it please!
I checked, I get NameError: name 'num' is not defined
which is not an invalid value, but it stops the execution with an error anyway
you need to deal with invalid values better
Thank you. I’m running it in the autograder. I also test it in IDLE.
Thank you. I tested at various moments and always get the same result.
I don’t understand why if I get a exact same match with the “desired output” in the auto-grader, how can I fix the code? I don’t know what can I do next. Please, can you help to pass through this?
It might appear as working if during first iteration valid number is submitted. If you are running it in IDLE over and over again, the num
could be defined also from previous times as well.
Thank you for your help. I finally could solve the inconvenience. I rewrited the program again, starting anew, from scratch. And you now what? It worked. The auto grade server accepted it.