Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python programming question: D&D character generator Write a program to generate a random Dungeons & Dragons character from the specifications below. Name : write a

Python programming question: D&D character generator

Write a program to generate a random Dungeons & Dragons character from the specifications below.

Name: write a function randomName() that randomly chooses a first and last name and then concatenates and returns them. You can use names of your own devise, or you can use the following traditional D&D names. First: Drizzt, Elminster, Raistlin, Kitiara, Caramon, Morte, Dak'kon, Annah, Lady, Fistandantilus Last: Majere, Of Pain, Creakknees, Starbreeze, Brightblade, Ariakas, Dragonbane, Burrfoot

Class: write a function randomClass() that randomly chooses and returns the name of one of the following classes: Cleric, Fighter, Rogue, Wizard, Barbarian, Bard, Druid, Monk, Paladin, Ranger, Sorcerer, Warlock

Statistics: D&D characters have six numeric base stats: STR (strength), CON (constitution), DEX (dexterity), INT (intelligence), WIS (wisdom), and CHA (charisma); each of them is generated by rolling a six-sided die three times and adding up the rolls (in D&D parlance this is "3d6"). 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

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

More Books

Students also viewed these Databases questions

Question

What is contribution margin ?

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago