Question: The following function called call_superhero () takes no parameters and returns the string 'Spiderman' or 'Hulk'. def call_superhero () : if random. randint (0, 1)

 The following function called call_superhero () takes no parameters and returns

The following function called call_superhero () takes no parameters and returns the string 'Spiderman' or 'Hulk'. def call_superhero () : if random. randint (0, 1) == 0: return 'Spiderman' return 'Hulk' Using the function call_superhero () provided above, write a program that: 1. Asks the user whether they would like to call a superhero ('y' or 'n'). 2. Continues to prompt for and call a superhero until the user enters the string 'n'. 3. Creates and builds a list containing the results of each call to function call superhero () (i.e. a list containing the strings 'Spiderman' and 'Hulk'). You may use method list . append () to add the strings 'Spiderman' and 'Hulk' to the list. 4. Counts how many times the user has called a superhero and displays this to the screen once the user enters 'n' as follows (e.g. if a superhero was called 20 times): Number of superheros called: 20 EX 2 3 4 5 & 8 W E R T Y U S D F G H K Z X C B N M

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!