Python program State the function of each line in the follow

Python program: State the function of each line in the following code and give the output of the code. def main: num = 0 show_me (num) def show_me (arg): print (arg) if arg

Solution

Actual code should be below one for compiling fine in python

#define a method show_me with parameter
def show_me(arg):
   #print the arg value to the console
print(arg)
   #check if arg is less than 10
if arg < 10:
       #recursively call the show_me method
show_me(arg + 1)
#main method
def main():
   #num=0
num = 0
   #calls the show_me mthod with num=0
show_me(num)
main()
#end of main method

---output---
0   
1   
2   
3   
4   
5   
6   
7   
8   
9   
10
-------output---

You can make out the meaning of each line using the comments. Feel free to ask any doubts/queries. God bless you!

 Python program: State the function of each line in the following code and give the output of the code. def main: num = 0 show_me (num) def show_me (arg): print

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site