Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions