Reply To: I enjoyed the course but I did spend 1.5 days trying to troubleshoot what I was doing differently (I refactor code as I wr…

Forum Archive I enjoyed the course but I did spend 1.5 days trying to troubleshoot what I was doing differently (I refactor code as I wr… Reply To: I enjoyed the course but I did spend 1.5 days trying to troubleshoot what I was doing differently (I refactor code as I wr…

#23689
Markus Berg
Participant

    The simplest way to deal with the ‘ZeroDivisionError’ in the script would probably be to change

    obj.location = sum / n

    to

    if n > 0:
        obj.location = sum / n

    Not necessarily the cleanest way, but it works.