8000 Solution for task: Nickname Generator. · ZaytsevNS/python_codewars@a9b1b6e · GitHub
[go: up one dir, main page]

Skip to content

Commit a9b1b6e

Browse files
committed
Solution for task: Nickname Generator.
1 parent 60080b7 commit a9b1b6e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

7KYU/nickname_generator.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Solution for task: https://www.codewars.com/kata/593b1909e68ff627c9000186/
2+
3+
def nickname_generator(name: str) -> str:
4+
vowels: str = 'aeiou'
5+
if len(name) < 4:
6+
return "Error: Name too short"
7+
if name[2] in vowels:
8+
return name[:4]
9+
else:
10+
return name[:3]

0 commit comments

Comments
 (0)
0