2nd Semester Intro to Computer Science

What you will learn

Reading

Check your understanding

Pick an answer for each question. You can try again until you get it right.

1. What is debugging?

  • Writing a program as fast as possible
  • Finding and fixing errors in a program
  • Deleting a program that has errors
  • Adding comments to a program

Debugging means finding the cause of a problem in your code and fixing it.

2. Which line has a syntax error?

  • print("hi"
  • print("hi")
  • name = "Sam"
  • print(name)

A syntax error breaks Python's grammar rules; print("hi" is missing its closing parenthesis.

3. Python shows an error message when you run your program. What is the best first step?

  • Ignore it and run the program again
  • Delete the whole program
  • Read the message, which usually names the type of error and the line number
  • Restart the computer

Error messages tell you what went wrong and where, so reading them is the fastest way to a fix.

Downloads