Common Mistakes

Week 4,5 - Conditionals and Loops

1. Conditional pathways

If you are using a conditional structure such as if...elif...else, make sure that your computation follows the correct path and that you have more than one path to check if the condition is not satisfied with else.

For match case, you need to make sure that there is a case _ that follows the unmet condition path. This works as else argument in if conditionals.

2. Arguments of range()

Remember that the built-in function range() can take multiple arguments.

range(5)        #--> [0,1,2,3,4]

range(3,7)      #--> [3,4,5,6]

range(11,17,2#--> [11,13,15]

range(7,2,-2)   #--> [7,5,3]