- #1
acurate
- 17
- 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