-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscat.py
41 lines (37 loc) · 977 Bytes
/
scat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Jacobus Burger (2023)
# Info:
# Inspired by listening to some Cab Calloway, decided to make a program
# to convert a string to scat with decent flow. While working on it
# I realized that this is a decently complex problem.
def scat(string: str) -> str:
scats = {
'b': "bap",
'd': "do",
'e': "ee",
'f': "fee",
'h': "hee",
'j': "jack",
'k': "kap",
'l': "lee",
'm': "mo",
'n': "nap",
'o': "oo",
'p': "pah",
'r': "rum",
's': "scat",
't': "tat",
'v': "vee",
'w': "wee",
'z': "zap"
}
result = []
for i in range(len(string)):
phrase = scats.get(string[i], None)
if phrase is not None:
result.append(phrase)
else:
result.append(string[i])
return ''.join(result)
if __name__ == '__main__':
string = input("gimmie a rhyme: ").lower()
print(scat(string))