When debugging a program, whether it be your own or someone elseβs, itβs best to understand what the program is trying to do first. Read through the code and comments before editing the program. Also, when errors occur, it helps to start from the line number of the error and work your way backwards.
Subsection12.4.1Level 1
The program below contains multiple errors. Your objective is to debug the program, and match the expected output (see below the code). You can run the code to see error messages.
Note12.4.3.
You do not need to delete any lines of code, only edit/add.
For the following inputs:
loan = 5000
time = 12
rate = 6.25
The program should print:
> Your annual compound interest is: 5349
Subsection12.4.2Level 2
The program below contains one syntax error and two semantic (logic) errors.
Your objective is to debug the program, and match the expected output (see below the code).
Note12.4.4.
There are three errors on three separate lines
For a dog weighing 7.7 kg, the output should look like:
For a dog weighing 16.94 pounds,
your vet will likely prescribe an amount of aspirin as follows:
84.7 milligrams one to 2 times per day.
Do not exceed the daily maximimum dosage of: 169.4 milligrams
Subsection12.4.3Level 3
The following is a screenshot of turtle output. The program uses three turtles: 2 white and 1 red.
Note12.4.5.
The windows size is 400 pixels by 400 pixels (default size)
You must recreate the output using the following guidelines:
The white turtles have pen size is 1, while the red has pen size 2
The red turtle draws last
The red turtle draws a singular line at a random angle from 0-360 and a random length from 0 to 200