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