CSE101 – Solved

$ 20.99
Category:

Description

GitHub Classroom

Lab 3 – Errors and Exceptions
Exceptions

• Why would you ever expect errors?
• If you can expect something, can’t you prevent that?

Exceptions

try:
<Your statements here> except <Name of first exception you wish to handle>:
<Your emergency code here> except <Name of first exception you wish to handle>:
<Your other emergency code here> else:
<If no exception…>
Exercise

You are expected to finish this task in less
than 60min
Closely examine the skeleton code (lab3.py) to infer the data types
• You are not allowed to change existing codes
• Only fill in the ‘TODO’ parts
Exercise

Task 1 Use exception handling to take care of the number format
• These dates should strictly consist of numbers
• Forcibly converting a non-numeric string to a number will result in an exception
Task 2 Use string methods to achieve the same result
• How do you find out if the string consists of numbers?
• You can find the appropriate method in the class slides or in the python documentation

Reviews

There are no reviews yet.

Be the first to review “CSE101 – Solved”

Your email address will not be published. Required fields are marked *