We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c02c43 commit ec099c8Copy full SHA for ec099c8
2 files changed
13_random_name_generator.py
@@ -0,0 +1,26 @@
1
+from random import randint
2
+
3
4
+def random_name_generator(first, second, x):
5
+ """
6
+ Generates random names.
7
+ Arguments:
8
+ - list of first names
9
+ - list of last names
10
+ - number of random names
11
12
+ names = []
13
+ for i in xrange(0, int(x)):
14
+ random_first = randint(0, len(first)-1)
15
+ random_last = randint(0, len(second)-1)
16
+ names.append("{0} {1}".format(
17
+ first[random_first],
18
+ second[random_last])
19
+ )
20
+ return set(names)
21
22
23
+first_names = ["Drew", "Mike", "Landon", "Jeremy", "Tyler", "Tom", "Avery"]
24
+last_names = ["Smith", "Jones", "Brighton", "Taylor"]
25
+names = random_name_generator(first_names, last_names, 5)
26
+print '\n'.join(names)
readme.md
@@ -12,3 +12,4 @@
1. **10_find_files_recursively.py**: recursively grab files from a directory
1. **11_optimize_images_with_wand.py**: recursively grab images from a directory, then optimize them for the web
1. **12_csv_split.py**: Splits a CSV file into multiple files based on command line arguments.
+1. **13_random_name_generator.py**: random name generator
0 commit comments