Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Have you ever considered a life of danger & adventure? If so, you need a great pirate name for inspiration. But thinking up one is

image text in transcribed
image text in transcribed
Have you ever considered a life of danger & adventure? If so, you need a great pirate name for inspiration. But thinking up one is really hard. So let's use what you've learned about files and strings to write a Python program that generates random pirate names. Your program should: read nouns and adjectives from this source file store each set of words in a separate list, prompt the user to enter their last name, display a randomly selected adjective and noun, along with the user's name. For example: Enter your last name: jones Your pirate name is: pockface mccoy jones You can use this code to continue prompting the user for a name until they end the program. while True: Last.name-nput"Enter your last name: Hint: Your program needs to read the source file and store words only once when run, Each set of words is prefaced with a word-type identifier & equals sign. Your program should exclude those. You'll need to use separate random numbers for each word type, You can generate a random number like so, where n is the number of words to choose from: # this code generates a random number between and n import random choice random.randrange(n) Extra Credit Capitalize the first letter of each adjective, noun, and last name. For multi-word adjectives, capitalize both words-e.g. 'Soft Shoe Skipper Edwards For nouns beginning with 'mc, capitalize the 'm' and the letter after'c: For example: 'Slippery McFishy Edwards

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions

Question

3. Describe the strategic training and development process.

Answered: 1 week ago

Question

10. Microsoft Corporation

Answered: 1 week ago

Question

4. EMC Corporation

Answered: 1 week ago