Can't pass internal test | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can't pass internal test

Hello dear friends, this task is easily, but I can not find mistake. Below text of task and my code: Text of task: You are making a registration form for a website. The form has a name field, which should be more than 3 characters long. Any name that has less than 4 characters is invalid. Complete the code to take the name as input, and raise an exception if the name is invalid, outputting "Invalid Name". Output "Account Created" if the name is valid. Sample Input abc Sample Output Invalid Name My code: try: name = input() #ваш код if len(name) < 4: raise ValueError except: print("Invalid Name") else: print("Account created")

11th Jan 2022, 5:20 AM
Lyapunov Alexander
Lyapunov Alexander - avatar
6 Answers
+ 9
But in this challenge, you just have to raise an error message. It can be ValueError or NameError. Here, c should be changed to uppercase in "Created".
11th Jan 2022, 6:31 AM
Simba
Simba - avatar
+ 6
print("Account Created)
11th Jan 2022, 5:40 AM
Simba
Simba - avatar
+ 1
NameError
11th Jan 2022, 5:23 AM
NEZ
NEZ - avatar
+ 1
Thanks! How important is it to use the correct name of the exception in this case, or is it necessary only to pass the internal test?
11th Jan 2022, 5:44 AM
Lyapunov Alexander
Lyapunov Alexander - avatar
+ 1
Many thanks!
11th Jan 2022, 6:10 AM
Lyapunov Alexander
Lyapunov Alexander - avatar