Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write in Payton Please don't dopy from other qustion in the chegg, that answers are wrong. 1. Define a new array called weapons and add
Write in Payton Please don't dopy from other qustion in the chegg, that answers are wrong. 1. Define a new array called weapons and add 6 different weapon names in the array, with increasing levels of weapon strength. Use Fist, Knife, Club, Gun, Bomb, Nuclear bomb 2. Roll the dice (1-6) to choose which weapon you must use. Save the roll in a variable called weaponRoll. Add your weaponRoll to the hero's combat strength Use this variable as an index into the weapons array and print out the name of the hero's weapon. 3. Define the following condition: if weaponRoll is less than or equal to 2, print out "You rolled a weak weapon, friend". But if weaponRoll is less than or equal to 4, print out "Your weapon is meh" Else, print out "Nice weapon, friend! " 4. If the weapon rolled is not a Fist, print out "Thank goodness you didn't roll the Fist..." 5. Add error handling on all inputs eg. if input is not int, print an error message and halt
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