-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathname_generator.py
More file actions
74 lines (63 loc) · 1.99 KB
/
name_generator.py
File metadata and controls
74 lines (63 loc) · 1.99 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# name_generator.py
# By TJ Hertz, 2024
import random
mode = input('\nChoose mode: "1" (ADJECTIVE NOUN), "2" (NOUN NOUN), "3" (ADJECTIVE VERB), "4" (RANDOM MIX) (default)\n')
if mode == '':
mode = '4'
if mode not in ['1','2','3','4']:
raise RuntimeError("Unknown input mode")
mode = int(mode)
if mode != 2:
print("\nEnter adjectives one at a time, then leave input empty and press enter to continue:\n")
adjectives = []
while 1:
val = input()
if val == "":
break
else:
adjectives += [val]
print("\nEnter nouns one at a time, then leave input empty and press enter to continue:\n")
nouns = []
while 1:
val = input()
if val == "":
break
else:
nouns += [val]
if mode == 3 or mode == 4:
print("\nEnter verbs one at a time, then leave input empty and press enter to continue:\n")
verbs = []
while 1:
val = input()
if val == "":
break
else:
verbs += [val]
shortlist = []
while True:
if mode != 4:
type = mode
else:
type = random.choice([1,2,3])
if type == 1:
candidate = f'{random.choice(adjectives)} {random.choice(nouns)}'
elif type == 2:
candidate = f'{random.choice(nouns)} {random.choice(nouns)}'
elif type ==3:
candidate = f'{random.choice(adjectives)} {random.choice(verbs)}'
print ('\n\n' + candidate + '\n')
next_step = input('Add to shortlist? (enter "y" to add to shortlist, "custom" to add a custom entry, leave blank to skip to the next idea, "done" to view results)\n')
if next_step == 'y':
shortlist += [candidate]
print ('Added to shortlist!\n')
elif next_step == 'n' or '':
continue
elif next_step == 'done':
break
elif next_step == 'custom':
shortlist += [input('Enter custom name to add to shortlist:\n')]
else:
print ('\nUnknown input! \n')
print ("\n\nShortlist:")
for item in shortlist:
print(item)