🧩Stack Trace
Also known as Traceback, Backtrace
The crash report. It lists each function call that led to the error.
Think of it like
Think of it like footprints in snow. You follow them back to see where someone went.
Example
Emma's app crashes and prints a stack trace. Its last two lines point to line 2 of average and a ZeroDivisionError.
Why it matters
A stack trace turns "it crashed" into a file and a line number. It is the first thing to read when something breaks.
Definition
Example code
python
Traceback (most recent call last):
File "st.py", line 4, in <module>
print(average([]))
File "st.py", line 2, in average
return sum(scores) / len(scores)
ZeroDivisionError: division by zeroCommon mistake
Key takeaways
- 1A chain of calls. Each line is one step toward the crash.
- 2File and line. It says exactly where to look.
- 3Bottom first. In Python, the cause sits at the end.