Extend it:

Make your code cope when things go wrong
Error handling: Make your code cope when things go wrong

For this challenge you will need to use exception handling to catch common run time errors

Challenges:

 
  1. Use try and except around some code which tries to convert user input to an integer

    Hint: Surround a section of code which uses the int function to convert a string to an integer with try…except…

  2. Use try and except around some code which tries to convert user input to an real/float

    Hint: Surround a section of code which uses the float function to convert a string to an float / real with try…except…

  3. Use try and except around some code which tries to open a file

    Hint: Surround a section of code which uses the open function with try…except…

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.