1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
likoan [24]
2 years ago
12

Using recursion, write a program that asks a user to enter the starting coordinates (row, then column), the ending coordinates (

row then column), and calculates the number of paths from the starting coordinate to the ending coordinate.
Computers and Technology
1 answer:
Luden [163]2 years ago
4 0

Answer:

The program in Python is as follows

def Paths(row,col):

if row ==0 or col==0:

 return 1

return (Paths(row-1, col) + Paths(row, col-1))

row = int(input("Row: "))

col = int(input("Column: "))

print("Paths: ", Paths(row,col))

Explanation:

This defines the function

def Paths(row,col):

If row or column is 0, the function returns 1

<em> if row ==0 or col==0: </em>

<em>  return 1 </em>

This calls the function recursively, as long as row and col are greater than 1

<em> return (Paths(row-1, col) + Paths(row, col-1))</em>

The main begins here

This prompts the user for rows

row = int(input("Row: "))

This prompts the user for columns

col = int(input("Column: "))

This calls the Paths function and prints the number of paths

print("Paths: ", Paths(row,col))

You might be interested in
What feature of the new internet browser, microsoft edge, allows you to write or draw on a web page, highlight items, erase your
hodyreva [135]
Web Note. You can access the feature by selecting "Make a web note" and several options on the toolbar will pop up for use. Microsoft has a help page here: https://support.microsoft.com/en-us/help/17221/windows-10-write-on-the-web
6 0
3 years ago
True or False? Any edition or version of Windows can join a domain.
Veseljchak [2.6K]

Answer: TRUE! 100%

If I was helpful i would to be rated brainliest please thank you!

Explanation:

8 0
2 years ago
Does any one know how to do addition of binary numbers​
Alla [95]

Answer:

The addition of binary numbers is done by adding the digits starting from the right side of the numbers, in the same way as we add two or more base 10 numbers. In binary addition, the place values are given as ones, twos, fours, eights, sixteens, etc.

Explanation:

3 0
3 years ago
How did people figure qwerty keyboard set up, instead of the abcdef setup?
marissa [1.9K]

Answer:

They are arranged randomly because manual typewriters tended to jam if the user typed too fast - therefore the arrangement was intended to slow early typists down.

Explanation:

3 0
2 years ago
The code that is executed when the user clicks a button is known as ________.
aleksandrvk [35]
The code that is executed when the user clicks a button is known as
the widget (w)


3 0
3 years ago
Other questions:
  • Which type of cable is described as a central conductor wire that is surrounded by insulating materials and placed inside a brai
    13·1 answer
  • Why are computer messages encapsulated?
    13·1 answer
  • When a bank account pays compound interest, it pays interest not only on the principal amount that was deposited into the accoun
    15·1 answer
  • How do you run a function in python?
    5·1 answer
  • Which best describes color blindness?
    8·1 answer
  • What command can be used to export an nps backup file named npsconfig.xml that can be used to restore nps configuration on anoth
    12·1 answer
  • Practice problems on functions. Write C function(s) to carry out the specified tasks. For each problem, also write the suggested
    15·1 answer
  • Linda wants to apply for a job in a company of her choice. Which information would her potential employers likely review in her
    10·2 answers
  • Netiquette is the
    13·1 answer
  • Data becomes _____ when it is presented in a context so that it can answer a question or support decision makin
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!