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:
-
Read through the below sample code.
-
Predict what will be printed out. Remember that when reading through code we go line by line, as if we are the interpreter.
-
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started