Question
Python Coding Question: Boardgame player generator. Write a program to generate a random player from the following specs: Name : write a function randomName( )
Python Coding Question:
Boardgame player generator. Write a program to generate a random player from the following specs:
Name: write a function randomName( ) that randomly chooses a first and last name and then concatenates and returns them.
First: Myrtis, Liz, Delmar, Regina, Loyd, Lavonia, Ed, Lelah, Shaneka, Penny Last: Smith, Johnson, Williams, Jones, Brown, Davis, Miller, Wilson, Moore, Taylor
Class: write a function randomClass( ) that randomly chooses and returns the name of one of the following classes: chef, rancher, scientist, teacher, taxi driver, janitor, medical doctor, carpenter, blacksmith, florist, engineer, farmer
Statistics: Each character will have six numeric base stats: STR (strength), CON (constitution), DEX (dexterity), INT (intelligence), WIS (wisdom), and CHA (charisma); in the boardgame each of them is generated by rolling a six-sided die three times and adding up the rolls. Write a function randomStat( ) that randomly generates and returns such a number by adding together three random numbers between 1 and 6. You will then call this function six times in your main( ) to get the six stats you don't need to write six versions of the function (that would defeat the purpose).
In your main( ), then, you will call the functions you wrote according to the above to display the character's name, class, and six statistics. The randomName( ), randomClass( ), randomStat( ) functions should not print anything out; they should merely return their results and let main( ) do the printing.
(Hint: remember random.choice( ) to choose a random element of a list and random.randint( ) to choose a random integer.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started