[Beginner Python lesson] The Jewnerator: Generate a 100% authentic true Jewish name that would make Noseberg Shekelman proud!
1 19 Feb 2019 14:37 by u/Teledildonicist
This is a beginning Python lesson inspired by the book, "Impractical Python Projects". Specifically, the very first lesson: Silly Name Generator. Except, in this lesson, we are going to be creating The Jewnerator, a program to generate an absolutely, 100% true-to-life Jewish name!
First, we 'import random', giving us the ability to choose a random value from our list of Jewish names.
Next, we define our tuples: One for first names, and another for last names. Feel free to modify these as desired; you can even make a 100% authentic Negroid name generator!
The 'while True:' loop is, essentially, an infinite loop, since Python's "True" value always evaluates to boolean true.
Inside the loop is where the magic happens. We create 4 variables, first_name{1, 2} and last_name{1, 2}, and then choose a random element from our 'first' and 'last' name tuples. We do this with the 'random' module's 'choice' method, passing our first and last name tuples as arguments.
After we select our random values, we print them. We use print's .format method to print out our newly created Jewish name. The '{}' symbols are positional place holders, filling in the value of our first_name1 variable, in the order the arguments are passed to the .format method.
After printing our 100% authentic Jewish name, we give the user a choice to continue or quit. 'input' is Python's way of accepting user input. In this case, try_again is assigned whatever value the user inputs at our prompt.
Then, we use an 'if' statement, using the 'lower()' method to ensure that the input is lowercase. We do this so that the user can type either a 'N' or a 'n' and it will work.
If the user chooses 'n', that is, they do not what to continue generating 100% authentic Jewish names, the 'break' command runs, "breaking" us out of our infinite while loop.
Finally, we give the user one more prompt, allowing them to, essentially, press any key to quit.
We have our completed code below. This is my favorite name: Shekel Banker Jew Nose
Enjoy!
1 import random
2
3 print("The Jewnerator: Create a name to make Noseberg Shekelman proud.\n")
4
5 first = ('Nose', 'Jew', 'Shekel', 'Larry', 'Ron', 'David', 'Jay',
6 'Goy', 'Goyim', 'Bank', 'Banker', 'Marty')
7 last = ('Berg', 'Berger', 'Jew', 'Nose', 'Shekel', 'Shekels', 'Man',
8 'Jew', 'Gold', 'Silver', 'Bronze', 'Bron', 'Stein', 'Finkle',
9 'Bank', 'Banker', 'Goy', 'Goyim', 'Feld', 'Sein')
10
11 while True:
12 first_name1 = random.choice(first)
13 first_name2 = random.choice(first)
14 last_name1 = random.choice(last)
15 last_name2 = random.choice(last)
16
17 print("\n")
18 print("{} {} {} {}".format(first_name1, last_name1,
19 first_name2, last_name2))
20 print("\n")
21
22 try_again = input("\n\nTry again? (Press enter else n to quit)\n")
23 if try_again.lower() == "n":
24 break
25
26 input("\nPress enter to exit.")
7 comments
0 u/Nefarious-Nephilim 19 Feb 2019 15:21
Shekelnose Goyfeld - "Good goy. Now thats one more thing we don't have to generate ourselves".
0 u/DukeofAnarchy 19 Feb 2019 18:18
0 u/Teledildonicist [OP] 19 Feb 2019 19:55
Nice!
0 u/DukeofAnarchy 19 Feb 2019 21:02
Improved Jew generator with more names and ten results at a time:
0 u/Morbo 20 Feb 2019 00:42
Here's a different take on this:
print("\n(((" + input("Type name of 'fellow white person' article author.") + ")))\n")0 u/NeoGoat 22 Feb 2019 11:50
LOL!!! Even here in "programming" on voat!!!!
0 u/LeviGoldstein 22 Feb 2019 11:55
"Levi" is a fine name, that I am proud to carry. You don't have it yet.