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
Sarah has to add a picture from her computer file and add a caption to it. Arrange the steps in a correct sequence.
SVEN [57.7K]
Click Insert
click Picture
click From File
select the desired picture and again click insert
right-click the picture
click Insert Caption
write the caption and add it
5 0
3 years ago
Read 2 more answers
Balance is the design principle that is represented when using the Crop tool?
RUDIKE [14]

Answer:

The answer is "False".

Explanation:

The rule of thirds implies to the subject, which is not centered mostly on the picture because of new photography formats their shots. Its main object is a little off with one side by using a third-party principle, which draws your attention for the audience into another design, instead of only looking at the center. In another word, we can say that this rule is used as the definition to design the Crop tool to represent as an overlay.

8 0
3 years ago
The organization wants you to avoid situations that make you choose between its overall benefit and your
iren [92.7K]
Personal gain is the answer :))
3 0
3 years ago
Pseudocode for mystry algorithm
kari74 [83]

Answer:

Initially if x = a = 2437 and y = 875,  condition (1) that is x>y is true and output would be x = 1562 with y = 87

Explanation:

According to pseudo code the code will run until x becomes equal to y. Initially if x = a = 2437 and y = 875,  condition (1) that is x>y is true. So next step would be x=x-y and output would be x = 1562 with y = 875. With initial values x = a = 2437 and y = 875, x becomes equal to y after 21 iterations and output is x=y=1

                 X        Y

  1.      2437         875
  2.      1562         875
  3.       687          875
  4.       687          188
  5.       499          188
  6.       311            188
  7.       123           188
  8.       123           65
  9.       58            65
  10.       58             7
  11.       51              7
  12.       44             7
  13.       37             7
  14.       30             7
  15.       23             7
  16.       16              7
  17.        9              7
  18.        2              7
  19.        2              5
  20.        2              3
  21.        2              1
  22.        1               1
8 0
3 years ago
What level of system and network is required for cui
galben [10]

Answer:

CUI will be classified at a “moderate” confidentiality level and follow DoDI 8500.01 and 8510.01 in all DOD systems. Non-DoD systems must provide adequate security with requirements incorporated into all legal documents with non-DoD entities following DoDI 8582.01 guideline

Explanation:

6 0
3 years ago
Other questions:
  • Someone is retiring next year. What would be an appropriate amount of risk to take their investments?
    8·2 answers
  • What is used for World Wide Web?
    7·1 answer
  • For each of these statements find a domain for which the statement is true and a domain for which the statement is false. a) Eve
    13·1 answer
  • Which of the following is an open-source web browser?
    8·2 answers
  • What two statements about IPv6 addresses are true? This task contains the radio buttons and checkboxes for options. The shortcut
    7·1 answer
  • Credible sites contain __________ information,
    7·2 answers
  • When entering a function or formula in a cell, which is the first character
    15·1 answer
  • The physical layer of the OSI model is not foundational to any of the other layers. True or False
    8·1 answer
  • Point to ______ of a cell to fill the cell to the right or down.
    10·2 answers
  • the application you attempted to authenticate to is not authorized to use cas. contact your cas administrator to learn how you m
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!