DAY 13: DEBUGGING
<Analysing 3 coding files and debugging to find the errors and fixing them. >
<PROBLEM 1 >
<Identify the problem: In the if condition we need to use ‘==‘ instead of ‘=‘ to check if the modulus of 2 for number equals 0 on line 2 >
<Fixed Code >
<PROBLEM 2 >
<Identify the problem: according to the instructions the year needs to divisible by 400 not 4000 to be a leap year. Need to change to 400 on line 4>
<Fixed Code >
<PROBLEM 3 >
<Identify the problem: (1) The number needs to be divisible by 3 AND 5, so change operator to AND on line 3.
(2) If the number is not divisible by 3 or 5 it needs to printed so need to remove ‘[]‘ on line 11.
(3) if the first condition does not comply then the program needs to move onto the next one so need to use ‘elif‘ instead of ‘if‘ statements on lines 6 and 8>
<Fixed Code >