<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Lesson 37
Step1:  This code produces an incorrent response. The debugger can be used to go through the program line by line and find the errors.
Step2:  The problem with the program was that input() stores its responses as 'strings', and therefore concatenates as a string, not an integer. Assing an int() fixes this problem
Step3:  Stepping(s) into the next step of the program is more than just going to the next (n) or continuing (c) the program. 
It actually goes into the code of the function being called at that line.
Step4:  Tracing the function gains the following output
Step5:  Stepping is useful, but can be really slow. 
One way to let the program run normally until a an issue, i.e. breakpoints.
Coin Flip Program
Step6:  Factorial Program
Create a program that can return the n! of a number (5! = 1 * 2 * 3 * 4 * 5 = 120).
Step7:  Using continue(c) runs through every iteration, which means debugging this code would take a lot of work, since we'd have to go through every trial.
A faster option is merely to step right into the first if statement using the until(un) command.
Once at that point, you can also use the break('b') to set a breakpoint there for future jumping.
This continues the program until a new line is reached, i.e. by finishing the loop
<ASSISTANT_TASK:>
Python Code:
def simpleAdd(): 
    print('Enter the first nuber to add:')
    first = input()
    print('Enter the second number to add:')
    second = input()
    print('Enter the third number to add:')
    third = input()
    print('The sum is ' + first + second + third +'.')
simpleAdd()
Explanation: Lesson 37:
Using the Debugger
A debugger allows you to run a program line by line, in order to debug it at various stages.
NB: The ipdb module does not seem to play well in Jupyter, and may occasionally require a kernal restart. 
In iPython, the ipdb module holds an interactive debugging tool that acts similarly to the IDLE editor used in the book. 
It is started with idpb.set_trace(), and can take various arguments in the interactive prompt to provide information.
ipdb (iPython Debugger) Commands:
* the n(next) continues program execution to to the next line in the code. 
* the s(step) steps to the next line, whether its in the code or in the function itself (i.e. instead print() or input() here.
* the c(continue) command continues until another breakpoint. 
* The l(list) will list a larger portion of the code.
* The p(print) or pp(pretty print) will print an argument. 
* The a(arguments) will return the current arguments.
* The j(jump) command jumps to a line of code, skipping any other lines.
* The q(quit) command quits the iPython debugger.
* The ?(help) shows all available commands.
Use Cases:
* pp locals() to pretty print local variables (requires pprint module.)
* pp globals() to pretty print global variables.
* Change variables while the program is running by editing the locals() on the fly; step back and forward through the code with n and j.
Simple Adding Program:
End of explanation
import ipdb # Import the iPython debugger
def simpleAdd(): 
    ipdb.set_trace() # Invoke the iPython debugger
    print('Enter the first nuber to add:')
    first = input()
    print('Enter the second number to add:')
    second = input()
    print('Enter the third number to add:')
    third = input()
    print('The sum is ' + first + second + third +'.')
simpleAdd()
Explanation: This code produces an incorrent response. The debugger can be used to go through the program line by line and find the errors.
End of explanation
#import ipdb # Import the iPython debugger
def simpleAdd(): 
    #ipdb.set_trace() # Invoke the iPython debugger
    print('Enter the first number to add:')
    first = int(input())
    print('Enter the second number to add:')
    second = int(input())
    print('Enter the third number to add:')
    third = int(input())
    print('The sum is ' + str(first + second + third) +'.')
simpleAdd()
Explanation: The problem with the program was that input() stores its responses as 'strings', and therefore concatenates as a string, not an integer. Assing an int() fixes this problem:
End of explanation
def blah():
    print('blah')
    print('blah')
    print('blah')
    moreblah()
    print('blah')
    print('blah')
    print('blah')
    evenmoreblah()
    
def moreblah():
    print('more blah')
    print('more blah')
    print('more blah')
    evenmoreblah()
    
def evenmoreblah(): 
    print('even more blah')
    
print(blah())
Explanation: Stepping(s) into the next step of the program is more than just going to the next (n) or continuing (c) the program. 
It actually goes into the code of the function being called at that line.
End of explanation
import ipdb # Import iPython Debugger
def blah():
    ipdb.set_trace() # Invoke the iPython debugger
    print('blah')
    print('blah')
    print('blah')
    moreblah()
    print('blah')
    print('blah')
    print('blah')
    evenmoreblah()
    
def moreblah():
    print('more blah')
    print('more blah')
    print('more blah')
    evenmoreblah()
    
def evenmoreblah(): 
    print('even more blah')
    
print(blah())
Explanation: Tracing the function gains the following output:
End of explanation
import random
heads = 0
for i in range(1,1001):
    if random.randint(0, 1) == 1:
        heads = heads + 1
    if i == 500:
        print('Halfway done!')
        
print('Heads came up ' + str(heads) + ' times.')
Explanation: Stepping is useful, but can be really slow. 
One way to let the program run normally until a an issue, i.e. breakpoints.
Coin Flip Program:
End of explanation
import ipdb # Import iPython Debugger
import random
heads = 0
for i in range(1,1001):
    ipdb.set_trace() # Invoke the iPython debugger
    if random.randint(0, 1) == 1:
        heads = heads + 1
    if i == 500:
        print('Halfway done!')
        
print('Heads came up ' + str(heads) + ' times.')
Explanation: Factorial Program
Create a program that can return the n! of a number (5! = 1 * 2 * 3 * 4 * 5 = 120).
End of explanation
import ipdb # Import iPython Debugger
import random
heads = 0
for i in range(1,1001):
    ipdb.set_trace() # Invoke the iPython debugger
    if random.randint(0, 1) == 1:
        heads = heads + 1
    if i == 500:
        print('Halfway done!')
        
print('Heads came up ' + str(heads) + ' times.')
Explanation: Using continue(c) runs through every iteration, which means debugging this code would take a lot of work, since we'd have to go through every trial.
A faster option is merely to step right into the first if statement using the until(un) command.
Once at that point, you can also use the break('b') to set a breakpoint there for future jumping.
This continues the program until a new line is reached, i.e. by finishing the loop:
End of explanation
<END_TASK>