Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*Python* Reading Code - The following code contains errors and syntanx errors. In the area below write the line and the problem with the code.

*Python*

image text in transcribed

Reading Code - The following code contains errors and syntanx errors. In the area below write the line and the problem with the code. lgnore misleading comments, mislabeled output, incorrect results, etc. Identify only the errors that would cause a syntax error or a runtime error. def Get_Computer_Choice (user_choice str) > str: 2 """this is a docstring. did """ if user choice = "r". It would be helpful if it said what the function return "p" elif user choicep": 7 return "s" else: return "r" 10 winners = ["rs", "sp", "pr"] rps-dict = {"r" : "Rock", "p" ties wins = losses = 0 "Paper", "s" "Scissors"} 12 13 14 15 16 17 18 19 20 21 : : print("You are about to play RPS 2.0") until True: rps_str- input ("Please enter (R) ock (P) aper or (S)cissors, or ) to quit") rps_str -rps_str.lower () if rps-str-"r" or rps-str-"p" or rps-str-"s": comp_choice-Get_Computer_Choice (rps_str) combo_strrps_str comp_choice 23 24 25 26 27 28 29 30 31 32 If rps str == comp choice ties += 1 result_str"tied" elif combo str in winners: wins +1 result strwon" else: Losses1" result str"1ost" print ("You. You threw and I threw (". format( 3 4 35 36 result str, rps_dict[rps_str, rps_dict[comp_choice])) elif rps. Str -- "g". break else: 39 40 print("You have failed to enter valid input. For shame") pretty print("You lost , won and tied [".format (losses,wins, ties, losses)) LINE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions