Any tips on how to improve this code, it's a Nickname generator(sort of)... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Any tips on how to improve this code, it's a Nickname generator(sort of)...

https://code.sololearn.com/cd5pR7rsDA4u/?ref=app

18th Jul 2023, 2:36 AM
$BANANA$
8 Answers
+ 2
Noted!
18th Jul 2023, 3:45 AM
$BANANA$
+ 2
No need to categories cons. if vowels are already You can just do this: if name[3] not in vowels
18th Jul 2023, 3:55 AM
A͢J
A͢J - avatar
+ 2
Your code breaks when the input is less than 4 characters. You should add some comments at the top of your code, to instruct the user what they should type in the input, maybe give one or two examples.
18th Jul 2023, 4:15 AM
Tibor Santa
Tibor Santa - avatar
+ 2
You could simplify a lot by using a string for the character classes, and instead of listing lower and uppercase separately, just convert the character when comparing. vowels = "aeiou" if name[3].lower() in vowels (...)
18th Jul 2023, 4:21 AM
Tibor Santa
Tibor Santa - avatar
+ 1
Please use the + icon to insert the link to your code in the question description. Link in the title doesn't work, people cannot even have a look at what code you had in mind.
18th Jul 2023, 3:32 AM
Tibor Santa
Tibor Santa - avatar
+ 1
Yes you can send a dm but in my experience it is not very reliable, sometimes messages are not transmitted and they cannot contain code, url or special characters. Safer to communicate in comments below your code. Feel free to tag me.
18th Jul 2023, 2:58 PM
Tibor Santa
Tibor Santa - avatar
0
Thanks Tibor...though I don't fully understand your code...can I send you a DM?
18th Jul 2023, 1:40 PM
$BANANA$
0
Thanks so much Santa, what a true mentor you are👌
18th Jul 2023, 4:02 PM
$BANANA$