From 70581e083e80bbe0b28723c7ad933f1025f86c61 Mon Sep 17 00:00:00 2001 From: "scott.liu" Date: Thu, 8 Jun 2023 16:59:21 -0700 Subject: [PATCH] Tried some pdb test in real code --- Scott_Submissions/pdb_test.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Scott_Submissions/pdb_test.py diff --git a/Scott_Submissions/pdb_test.py b/Scott_Submissions/pdb_test.py new file mode 100644 index 0000000..b08d585 --- /dev/null +++ b/Scott_Submissions/pdb_test.py @@ -0,0 +1,28 @@ +import pdb + +def calculate_average(numbers): + total = sum(numbers) + average = total / len(numbers) + return average + +def main(): + data = [1, 2, 3, 4, 5] + + pdb.set_trace() + result = calculate_average(data) + print("The average is:", result) + + pdb.set_trace() # Set a breakpoint at this line + + print("Program execution resumed.") + # ... continue with the rest of your code + +if __name__ == '__main__': + main() + + +# n or next: Execute the next line of code. +# s or step: Step into a function call. +# c or continue: Continue execution until the next breakpoint or the program's end. +# p or print: Print the value of a variable. +# q or quit: Quit the debugger and exit the program. \ No newline at end of file