Sep-15-2018, 06:00 PM
(Sep-15-2018, 05:53 PM)Placebo Wrote: Hey, thanks for the PEP styleguide-link - gonna put it on my kindle and read through it.The value does not matter, if quest is neither smaller nor bigger than the secret number -
Regards to question 1.)
But some exact int-value does not need to be defined i.e how the program can know what the correct guessed number between 1 and 20 is?
else
in the snippet below actually is equivalent to elif guess == secretNumber
- but since this is the only remaining option, the condition is redundantif guess < secretNumber: print('Your guess is too low.') elif guess > secretNumber: print('Your guess is too high.') else: break # this condition is the right guess!
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.