Python253

ipp1_0_silly_name_generator

May 31st, 2024
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.76 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Filename: ipp1_0_silly_name_generator.py
  4. # Version: 1.0.0
  5. # Author: Jeoi Reqi
  6.  
  7. """
  8. Description:
  9.    - This script demonstrates "Chapter 1: Project #1 - Silly Name Generator" from the book "Impractical Python Projects" by Lee Vaughan.
  10.    - The script generates humorous pseudonyms by combining random first names with random last names.
  11.    - It utilizes the random module to select names from predefined lists.
  12.  
  13. Requirements:
  14.    - Python 3.x
  15.  
  16. Functions:
  17.    - generate_funny_name():
  18.        - Description:
  19.            -Generates a humorous pseudonym by combining a random first name and a random last name.
  20.            - Returns:
  21.                - str: A randomly generated pseudonym.
  22.  
  23. Usage:
  24.    - Ensure you have Python 3.x installed on your system.
  25.    - Save the script to a file, for example, `funny_name_generator.py`.
  26.  
  27. Running the Script:
  28.    - Open a terminal or command prompt.
  29.    - Navigate to the directory where the script is saved.
  30.    - Run the script using the command: python funny_name_generator.py.
  31.  
  32. Output:
  33.    - Upon running the script, a humorous pseudonym will be generated and printed to the console.
  34. """
  35.  
  36. import random
  37. import sys
  38.  
  39. # Lists of first and last names
  40. first_names = ['Baby Oil', 'Bad News', 'Big Burps', "Bill 'Beenie-Weenie'", "Bob 'Stinkbug'", 'Bowel Noises', 'Boxelder', "Bud 'Lite'", 'Butterbean', 'Buttermilk', 'Buttocks', 'Chad', 'Chesterfield', 'Chewy', 'Chigger', "Cinnabuns", 'Cleet', 'Cornbread', 'Crab Meat', 'Crapps', 'Dark Skies', 'Dennis Clawhammer', 'Dicman', 'Elphonso', 'Fancypants', 'Figgs', 'Foncy', 'Gootsy', 'Greasy Jim', 'Huckleberry', 'Huggy', 'Ignatious', 'Jimbo', "Joe 'Pottin Soil'", 'Johnny', 'Lemongrass', 'Lil Debil', 'Longbranch', '"Lunch Money"', 'Mergatroid', '"Mr Peabody"', 'Oil-Can', 'Oinks', 'Old Scratch', 'Ovaltine', 'Pennywhistle', 'Pitchfork Ben', 'Potato Bug', 'Pushmeet', 'Rock Candy', 'Schlomo', 'Scratchensniff', 'Scut', "Sid 'The Squirts'", 'Skidmark', 'Slaps', 'Snakes', 'Snoobs', 'Snorki', 'Soupcan Sam', 'Spitzitout', 'Squids', 'Stinky', 'Storyboard', 'Sweet Tea', 'TeeTee', 'Wheezy Joe', "Winston 'Jazz Hands'", 'Worms']
  41. last_names = ['Appleyard', 'Bigmeat', 'Bloominshine', 'Boogerbottom', 'Breedslovetrout', 'Butterbaugh', 'Clovenhoof', 'Clutterbuck', 'Cocktoasten', 'Endicott', 'Fewhairs', 'Gooberdapple', 'Goodensmith', 'Goodpasture', 'Guster', 'Henderson', 'Hooperbag', 'Hoosenater', 'Hootkins', 'Jefferson', 'Jenkins', 'Jingley-Schmidt', 'Johnson', 'Kingfish', 'Listenbee', "M'Bembo", 'McFadden', 'Moonshine', 'Nettles', 'Noseworthy', 'Olivetti', 'Outerbridge', 'Overpeck', 'Overturf', 'Oxhandler', 'Pealike', 'Pennywhistle', 'Peterson', 'Pieplow', 'Pinkerton', 'Porkins', 'Putney', 'Quakenbush', 'Rainwater', 'Rosenthal', 'Rubbins', 'Sackrider', 'Snuggleshine', 'Splern', 'Stevens', 'Stroganoff', 'Sugar-Gold', 'Swackhamer', 'Tippins', 'Turnipseed', 'Vinaigrette', 'Walkingstick', 'Wallbanger', 'Weewax', 'Weiners', 'Whipkey', 'Wigglesworth', 'Wimplesnatch', 'Winterkorn', 'Woolysocks']
  42.  
  43. def generate_funny_name():
  44.     """
  45.    Generates a humorous pseudonym by combining a random first name and a random last name.
  46.    
  47.    Returns:
  48.        str: A randomly generated pseudonym.
  49.    """
  50.     first_name = random.choice(first_names)
  51.     last_name = random.choice(last_names)
  52.     return f"{first_name} {last_name}"
  53.  
  54. if __name__ == "__main__":
  55.     print("Welcome to the Funny Name Generator!\n")
  56.     print("Generating a humorous pseudonym...\n")
  57.    
  58.     while True:
  59.         funny_name = generate_funny_name()
  60.         print(funny_name, file=sys.stderr)
  61.         print("\n")
  62.         try_again = input("Try again? (Press Enter else n to quit)\n")
  63.         if try_again.lower() == "n":
  64.             break
  65.    
  66.     input("\nPress Enter to exit.")
  67.  
  68.  
Add Comment
Please, Sign In to add comment