Py | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Py

try: name = str(input()) if (len(name) > 4): print("welcome " + name) print("HERE IS YOUR DATA") print("name:" + name) else: raise TypeError except: print("INVALID NAME")

5th Jan 2022, 4:57 AM
lucky hindustani gamer
3 Answers
+ 3
Tag the language you're using(Python, in this case) Your program is working fine, what is your question with this?
5th Jan 2022, 5:07 AM
Rishi
Rishi - avatar
+ 1
You don't need to use try, except in this case. If - else will do the work. name = input() if len(name)>4: print("you write what you want") else: print("invalid name")
5th Jan 2022, 11:24 AM
YoPycode
0
Yes Rishi
26th Jan 2022, 1:47 PM
lucky hindustani gamer