1. सीखें
  2. /
  3. पाठ्यक्रम
  4. /
  5. Intermediate Python for Developers

Connected

अभ्यास

Returning errors

Time to try out the other approach for error handling.

Revise the clean_text() function to intentionally produce an error if an incorrect data type is used.

निर्देश

100 XP
  • Check whether the data type of the text argument is a string str.
  • Inside the else block, produce a TypeError() to prevent the script from running and return a descriptive message.