0

Hi,can someone please help me what's wrong with this python code ? I keep getting the same loop.

name = "" while len(name) <= 12: name = input("what is your name? ") if len(name) > 12: print("Name can be max 12 characters long.Try again") elif len(name) < 6: print("Name must be min 6 characters long.Try again") else: print("Name is ok")

8th Sep 2020, 8:00 AM
Sushobhan Sengupta
5 odpowiedzi
+ 6
Sushobhan Sengupta because you can only input your answer once here on SoloLearn yes you need break name = "" while len(name) <= 12: name = input("what is your name? ") if len(name) > 12: print("Name can be max 12 characters long.Try again") break elif len(name) < 6: print("Name must be min 6 characters long.Try again") break else: print(f"Name is ok {name}") break
8th Sep 2020, 8:20 AM
BroFar
BroFar - avatar
+ 1
I don't see anyway to break out of while loop?
8th Sep 2020, 8:07 AM
Abhay
Abhay - avatar
+ 1
Sushobhan Sengupta What are the expected inputs and outputs ,any example?
8th Sep 2020, 8:14 AM
Abhay
Abhay - avatar
0
Hi Abhay, I'm a beginner..can you help me out ?
8th Sep 2020, 8:10 AM
Sushobhan Sengupta
0
Just type in a name as input and if it is it's length is larger than 12 then show that "Name can be max 12 characters long.Try again" and you have type your name again.And if it is it's length is smaller than 6 then show that "Name must be min 6 characters long.Try again" and you have type your name again. and if the length of your name is between 6 and 12 then it will show "Name is ok".
8th Sep 2020, 8:19 AM
Sushobhan Sengupta