Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the following python code to be modified by using map function, with no loops Sample run: _______________________ import random import math def Game():

I need the following python code to be modified by using map function, with no loops Sample run: image text in transcribed _______________________ import random import math def Game(): Points_List = [] Scores_Tuple = [] total_score = 0 for i in range(1,11): #creating 10 random tuples a = random.randint(0,15) b = random.randint(0,15) Points_List.append((a,b)) for i in Points_List: #printing for each point print("-------------------------------------------------------") print("Hit point is "+ str(i)) print("Center is (0,0)") distance = 0 for j in i: distance = distance + j*j distance = math.sqrt(distance) print("The distance is "+str(distance)) if distance>11: print("False") print("Outside of the dart board!") else: print("True") print("Hit the board!") if(distance >= 0 and distance= 4 and distance= 8 and distance= 12 and distance= 16 and distance= 19): print("Score: " + str(19)) Scores_Tuple.append(19) total_score = 0 print("-------------------------------------------------------") for i in Scores_Tuple: total_score += i print("Total Score is " + str(total_score)) #printing the total score if __name__ =="__main__": print(" ^^** Playing Dart Game ^^** ") print("*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*") Game()
Hit Point is: (6, 3) Center is: (0, 0) The distance is: 6.708203932499369 Result: True Hit the board! Score: 5 Hit Point is: (7, 2) Center is: (0, 0) The distance is: 7.280109889280518 Result: True Hit the board! Score: 3 Hit Point is: (8, 8) Center is: (0, 0) The distance is: 11.313708498984761 Result: False Outside of the dart board

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_2

Step: 3

blur-text-image_3

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Are they spending less time with family and friends?

Answered: 1 week ago

Question

4. What decision would you make and why?

Answered: 1 week ago