Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python I need the answers to those questions, please password attempts pass; 0; : def validate (p): global attempts attempts += 1 if p ==

python

I need the answers to those questions, please

image text in transcribed

image text in transcribed

password attempts "pass"; 0; : def validate (p): global attempts attempts += 1 if p == password and attempts = 5: print ("Too many attempts.") return false else: return false user = "default" while not validate (user): user = input ("What is the password?") else: print ("HERE ARE ALL THE SECRETS") d. What would happen if we tried to reference the p variable outside of validate()? e. Why do you think it's necessary to include the global keyword in validate() for attempts but not for password

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

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

adults living in the state of Washington

Answered: 1 week ago