Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program called 'tracer.py' that may be used to assist with debugging Python programs. Given the name of a Python program as input, 'tracer.py'
Write a program called 'tracer.py' that may be used to assist with debugging Python programs. Given the name of a Python program as input, 'tracer.py' will insert a trace statement at the beginning of each function definition. Given the name of a program that already contains trace statements, 'tracer.py' will remove them Say, for example, we have the following program, 'rfunction.py' # reverse a string, Hussein Suleman, 18 march 2015 def reverse string (sentence): new sent for i in range len (sentence)-1,-1,-1): new sent -new sent + sentence [i] return new sent def main O: sent -input ("Enter a sentence:") print (reversestring (sent)) print (reverse string (sent+sent)) main ) Here's a sample of its behaviour: Enter a sentence: how now brown cow woc nworb won woh woc nworb won wohwoc nworb won who Given the file name 'rfunction.py' as input, 'tracer.py will produce the following transformation: """DEBUG""" # Reverse a string, Hussein Suleman, 18 march 2015 def reverse string (sentence): ""DEBUG""":print ('reverse string') new sent- for i in range (len (sentence)-1,-1,-1): new sentnew sent sentence [i] return new sent def main O: DEBUG""": print ('main') sentinput ("Enter a sentence: ") print (reversestring (sent)) print (reverse string (sent+sent))
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