Jun-11-2019, 03:31 AM
I'm interested in understanding how to implement Python's trace module to follow the execution of a multiplication table and print its annotated results.
I researched Python documentation and internet sources related to trace() and the multiplication program to figure out how use the trace module, but I came up empty-handed.
Any assistance on how the integrate the trace module with the multiplication table is appreciated.
I researched Python documentation and internet sources related to trace() and the multiplication program to figure out how use the trace module, but I came up empty-handed.
import sys
import trace
tracer = trace.Trace(
ignoredirs=[sys.prefix, sys.exec_prefix],
trace=0,
count=1)
def print_multiples(n, high):
for i in range(1, high+1):
print(n * i, end=" ")
print()
def print_mult_table(high):
""" Return a multiplication table with n rows and columns."""
for i in range(1, high+1):
print_multiples(i, high)
print_mult_table(7)
r = tracer.results()
r.write_results(show_missing=True, coverdir=".")The program outputs a multiplication table, so there are no error messages. I'm using Win 8.1, Python version 3.7.3 (64-bit), and an Intel core i7-based system.Any assistance on how the integrate the trace module with the multiplication table is appreciated.
