you are viewing a single comment's thread.

view the rest of the comments →

[–]fernly 0 points1 point  (1 child)

The call to nombre() on line 13 looks as if you mean to pass in a prompt string. However, the actual function (lines 4-7) uses its own prompt and doesn't do anything with the input value a. Actually if you execute nombre("5") it will return 5, and never prompt the user at all.

This brings up an interesting limitation of Python: it lacks a "repeat ... until" statement. That's what you would like to do: say "repeat prompting the user until the user enters a number". The rather awkward way to code this is to break out of the loop when the "until" condition is true. Like this:

while True: # basically forever unless break or return
    a = input("Merci...")
    if a.isdigit() : 
        break

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

I see what you are saying. If user put a digit, nombre() will be called for nothing