Coding Task: 02.01 Buggy Code

When something goes wrong in code, we say that we’ve got a bug. A bug is a problem that needs to be fixed. You wrote this code in the last lesson to display Hello, world! on the screen.

print("Hello, world!")

What if you misspelt print by typing in primt instead?

primt("Hello, world!")

Your Task

In the editor below, type the code above and Run it so that the program displays an error message. Then, using the worksheet you opened, copy the error message into the middle column in the third row.

Then, try copying the code shown in the left column into the editor below and Run it too! Copy the last line of any error messages you get into the middle column of the worksheet, and then write the correct version of the code in the right column.

Python Reference Sheet

Remember to use the Python reference sheet to help you with your code! Click on one of the buttons below:

Requirements

  • The program should run with lots of errors, and that’s on purpose!
  • Try to Run each line of code in the left column of the worksheet.
  • Copy the last line of any error messages you get into the middle column, and then write the correct version of the code in the right column.
  • Some pieces of code might not have any errors. In that case, write No error in the middle and right columns.
  • Hint: Put a # in front of each line of code after you Run it, so that you don’t get the same error every time!

Example

Below is an example of an error message in code. Remember, you only want the last line:

NameError: name 'primt' is not defined on line 3
Scroll to Top