Course Content
Mastering Python: Annotations, Errors and Environment
Mastering Python: Annotations, Errors and Environment
Challenge: Safely Auth
Note
These comments help you find the code that needs to be modified:
========== Modify code below ==========
========== Modify code above ==========
Task
You have implemented the login()
function, which raises errors. Implement the safely_auth()
function that uses the login()
function and catches errors.
- Create a code block to track errors (mention the keyword).
- Call the
login()
function in the error tracking block. - Catch the
TypeError
and save its info inside theerror
variable. - Print the
error
variable (error info) in the console. - Catch the
ValueError
and save its info inside theerror
variable.
Thanks for your feedback!
Challenge: Safely Auth
Note
These comments help you find the code that needs to be modified:
========== Modify code below ==========
========== Modify code above ==========
Task
You have implemented the login()
function, which raises errors. Implement the safely_auth()
function that uses the login()
function and catches errors.
- Create a code block to track errors (mention the keyword).
- Call the
login()
function in the error tracking block. - Catch the
TypeError
and save its info inside theerror
variable. - Print the
error
variable (error info) in the console. - Catch the
ValueError
and save its info inside theerror
variable.
Thanks for your feedback!
Challenge: Safely Auth
Note
These comments help you find the code that needs to be modified:
========== Modify code below ==========
========== Modify code above ==========
Task
You have implemented the login()
function, which raises errors. Implement the safely_auth()
function that uses the login()
function and catches errors.
- Create a code block to track errors (mention the keyword).
- Call the
login()
function in the error tracking block. - Catch the
TypeError
and save its info inside theerror
variable. - Print the
error
variable (error info) in the console. - Catch the
ValueError
and save its info inside theerror
variable.
Thanks for your feedback!
Note
These comments help you find the code that needs to be modified:
========== Modify code below ==========
========== Modify code above ==========
Task
You have implemented the login()
function, which raises errors. Implement the safely_auth()
function that uses the login()
function and catches errors.
- Create a code block to track errors (mention the keyword).
- Call the
login()
function in the error tracking block. - Catch the
TypeError
and save its info inside theerror
variable. - Print the
error
variable (error info) in the console. - Catch the
ValueError
and save its info inside theerror
variable.