Question: Debugging Activity Read. analyze and respond to errors in code. Instructions: Read through the below sample code. Predict what will be printed out. Remember that

Debugging Activity

Read. analyze and respond to errors in code.

Instructions:

  1. Read through the below sample code.

  2. Predict what will be printed out. Remember that when reading through code we go line by line, as if we are the interpreter.

  3. Run the code, display the stack trace, and analyze the error message reported.

Code Example

1 favorite_number_str = input("What is your favorite number: ")

2 birth_month_str = input("What month were you born in: ")

3

4 lucky_number = int(favorite_number_str) + int(birth_month_str)

5 print("Your lucky number is " + lucky_number)

Debugging is the process of tracking and fixing errors in your code.

Indentation Errors: "IndentationError: unindent does not match any outer indentation level"

Discussion Questions:

Why are these errors caused and how they nd/x this type of error?

Suggest using the tab key to indent and the shift-tab to remove an indent as ways to avoid the error.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!