-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_first_name.py
More file actions
29 lines (25 loc) · 919 Bytes
/
create_first_name.py
File metadata and controls
29 lines (25 loc) · 919 Bytes
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
import random
import get_list
#
# gender = ['male', 'female']
# nationality = ['en', '']
def first_name_selection(json_file_path=None, gender='male', nationality='en'):
names = get_list.get_list(json_file_path)
if names != None and type(names) == dict:
return random.choice(names[gender][nationality]) #+ " : male"
elif names != None and type(names) == dict and gender == 'female':
gender = 'female'
nationality = 'de'
return random.choice(names[gender][nationality]) #+ " : female"
else:
return "Enter variable \"names\"!"
#
if __name__ == "__main__":
print ("Start programm play!\n")
fisrt_name = "first_names.json"
# print(fisrt_name)
res_first_name = first_name_selection(fisrt_name, gender='male', nationality='us')
print(res_first_name)
print ("\nEnd programm play!")
else:
print ("An error has occurred! Unable to start")