Last answered:

27 Feb 2024

Posted on:

26 Feb 2024

0

Question 1 error and alternative solution

Hello everyone,



Probably someone already pointed this out, but I couldn't find it in the questions, so bear with me please.

I believe there's an error in the solution to question 1.

In the while loop num_1 and num_2 are checked to be lower than 0. This, however, modifies the range making it between 0-100 instead of 1-100.

So I trust the code should be 

while num_1 < 1 or num_2 < 1 or ...



Moreover, here's my version of the exercise with the string problem solved:



Happy coding :D

1 answers ( 0 marked as helpful)
Instructor
Posted on:

27 Feb 2024

1

Hey Jessica,


Thank you for reaching out!


You're right, thank you for pointing this out. The conditions should indeed be:

while num_1 < 1 or num_2 < 1 or num_1 > 100 or num_2 > 100 or num_1 == num_2:
...

or

while num_1 <= 0 or num_2 <= 0 or num_1 > 100 or num_2 > 100 or num_1 == num_2:

Alternatively, you can change the instruction to:

Please enter a number between 0-100

Enjoy the rest of the course! :)

Kind regards,

365 Hristina 

 

Submit an answer