Answered step by step
Verified Expert Solution
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: _______________________ 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
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