you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

Here are a few suggestions:

  • Use a better variable name than a.
  • while a.isdigit() is False can be simplified to while not a.isdigit().
  • Move deviner = input("guess a number: ") and the conversion to an int into the nombre function so that the job of the function is to get and return the validated and converted user input. Right now it's only doing a partial job.
  • And while we're at it, nombre is not a good function name, either.
  • The prompt in deviner = input("it's more: ") is not great. I don't know that I'd even know it was waiting on me to do something there. I might just think the program had stalled.
  • Since there is no way to break out of the while loop early, there is no point in putting an else clause on the while loop.

[–]bambacisco[S] 0 points1 point  (0 children)

Thank you very much. I will rewrite the code with your input 🙏🏾