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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!