def sum(a, b):
# a = 1
# b = 2
# sum(a, b) = 3
return a + b
def sum(a, b):
"""
a = 1
b = 2
sum(a, b) = 3
"""
return a + b
def sum(a, b):
"""
>>> a = 1
>>> b = 2
>>> sum(a, b)
3
"""
return a + b
def sum(a, b):
'''
a = 1
b = 2
sum(a, b) = 3
'''
return a + b
Correct Answer:
def sum(a, b):
"""
>>> a = 1
>>> b = 2
>>> sum(a, b)
3
"""
return a + b
Explanation: Use """ to start and end the docstring and use >>> to represent the output. If you write this correctly you can also run the doctest using build-in doctest module