Machine Problem
Random Module in Python
1. Create a Random Name Generator App
2. Create 3 lists for first name, middle name, and last name with 10 items per list
3. The application will ask the user to generate a new name.
4. If yes, use a random number between 0 - 9 to randomly select items in the lists
5. Display the generated name “Congratulations!
Your new name is ________
6. If No, display the word “Thank you! ” and display all the names that user generated.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website, kindly contact me also at my email address also. Thank you.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
My mobile number here in the Philippines is 09173084360
Program Listing
import random
first = ["Kai", "Hunter", "Luca", "Quinn", "River", "Skylar", "Hayden", "Riley", "Reese", "Jude"]
middle = ["Abbot", "Griffith", "Maxfield", "Rufus", "Eva", "Emma", "Olivia", "Sims", "Tan", "Ovilda"]
last = ["James", "Doha", "Harden", "Jordan", "Bryant", "Williams", "Simmons", "Imbid", "George", "Leonard"]
namebank = []
while True:
name = input("Do you want to generate a new name? [y/n]: ")
if name.upper() == "Y":
rand = random.randint(0, 4)
randname = first[rand] + " " + middle[rand] + " " + last[rand]
namebank.append(randname)
print(f"Your new name is {randname}\n")
continue
elif name.upper() == "N":
print("Thank you!")
print("List of generated names:")
for x in namebank:
print(f"{x}")
break
Google has added a random name picker directly into Classroom. There is a small catch, currently, it's only available on an Android device as well as our newer Chromebooks. The beauty of it is you don't have to add anything new, it's already there inside Classroom.
ReplyDelete