Python checking numbers in a given name

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 replies · 1K views
acurate
Messages
17
Reaction score
1

Homework Statement


I need to write a Python program, which would:

1) Ask for a name (input function)
2) Keep asking for the name if it is not entered correctly(if it has a digit in it)
3) If the name is entered correctly it will print the name

Homework Equations


How should I continue the program? I tried another way, when I enter for example "J4ck" it asks to enter the name again but when I enter "Jack" for the program to print it, it repeats the name "Jack" 4 times in a row. Any suggestions?

The Attempt at a Solution


Code:
while True:
    name = input("Enter a name: ")
    for x in name:
        if x.isdigit():
            break
 
on Phys.org
Is your instruction to print the name contained within the 'for x in name' loop? If so, the interpreter will print the name as many times as there are letters in the name.