+ 1
Error handling with random number [solved]
Hi all! I did the following paractise code. https://code.sololearn.com/cyqK6NM27Q1Y/#py My problem is: if you do not press 'c', 'l' or 'h', the program repeats the question but with a different random number. I would like the program to keep the original random number until the users enters a valid input (which is 'c', 'l' or 'h'). Thanks in advance for your help!
3 Answers
+ 2
Just put the a=rd(low,up) in front of the while sloop....then it will not be changed each time
If you then want it to be changed if h was touched you can add this statement there in the if case...
+ 1
Thanks Alexander. Works perfectl now.
0
Coolđ