Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this exercise, you enforced the preconditions for time _ to _ minutes, so that it would always crash when the precondition was violated (

In this exercise, you enforced the preconditions for time_to_minutes, so that it would always crash when the precondition was violated (allowing you to respond to this crash with a try-except). However, the main reason for enforcing preconditions is to ensure that time_to_minutes crashes in a controlled way. Even without the asserts, time_to_minutes will often crash on inputs that violate the precondition. For example, remove the asserts and try the function call time_to_minutes('apple').
Were the asserts necessary to complete this exercise? Why or why not?

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions