Question: Hi, , taking beginning python. Need a little help with programming exercise 2 chapter 12 from the book on chegg called Starting out with python
Hi, , taking beginning python. Need a little help with programming exercise 2 chapter 12 from the book on chegg called Starting out with python 3rd Edition by Tony Gaddis.I tried to use some of the info but could not get it to work..
# Define the function multiply.
def multiply(x, y):
if x == 0:
return 0
else:
print(y, end="")
if x - 1!=0:
print("+",end="")
return y + multiply(x-1, y)
def main():
x = int(input("Enter the first number."))
y = int(input("Enter the second number."))
print('x,"x",y = end =')
print("=",multiply(x,y))
main()
My syntax is coming back with my answer.
Thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
