Lesson 2/2~48 min

Programming challenges

Programs that do not crash: KeyError, ValueError, division by zero and raising your own exceptions.

After this lesson you'll be able to:

  • Write a whole program from a specification and check it with tests
  • Print exactly what the task asks for - the tests compare the output line by line (trailing spaces do not matter). Write any prompt you like in input("…"); the tests ignore it.
  • The last task is an optional bonus if you want more.

What you practise here

Real programming tasks: write a program, run it and submit it to be checked, hidden tests included.

  1. Write a programThe price of an itemBasic10 XP
  2. Write a programA safe quotientElementary20 XP
  3. Write a programChecking the sides of a rectangleElementary20 XP
  4. Write a programReading a decimal numberIntermediateOptional30 XP