Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following code:# guessing.pyimport random# Some global password information which is hard - codedpasswords = { joe : world 1 2 3

Consider the following code:# guessing.pyimport random# Some global password information which is hard-codedpasswords={"joe": "world123","jane": "hello123"}def game():"""A guessing game """# Use 'input' to read the standard inputvalue=input("Please enter your guess (between 1 and 10): ")print("Entered value is",value)if value == random.randrange(1,10):print("You won!")else:print("Try again")if __name__=="__main__":game()The given code provides information about passwords on entering invalid input, as shown:$ python2 guessing.pyPlease enter your guess (between 1 and 10): passwords('Entered value is',{'jane': 'hello123', 'joe': 'world123'})Try againHow can you make the code more secure in Python 2?Each correct answer represents a complete solution. Choose three.This type of question contains radio buttons and checkboxes for selection of options. Use Tab for navigation and Enter or space to select the option.Aoption AReplace input with raw_input.Boption BCast the return data to an int.Coption CAdd an exception handler.Doption DUse eval function.

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

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