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
sdas [7]
1 year ago
12

write a recursive function that accepts an integer argument, n. the function should display n lines of asterisks on the screen,

with the first line showing 1 asterisk, the second line showing 2 asterisks, up to the nth line which shows n asterisks.
Computers and Technology
1 answer:
liraira [26]1 year ago
3 0

The follwing code represents the recursive function :

def main():

y = int(input("Please input the number of asterisks that you want to start from= "))

x = int(input("Please input the number of asterisks that you would like to draw= "))

ast(y, x)

def ast(b, a):

if b < (a + 1):

 print("*" * b)

 ast(b+1, a) # Recursive function

else:

 return 0

 

main()

Output:

Please input the number of asterisks that you want to start from= 1

Please input the number of asterisks that you would like to draw= 5

*

**

***

****

*****

Python also permits function recursion, allowing defined functions to call one another. Python allows function recursion, which lets defined functions call one another.

Recursion is a common concept in both arithmetic and programming. It indicates when a function calls itself. The benefit of this is that you can loop through the data to get a conclusion.

We are aware that a Python function has the ability to invoke another function. It's possible for a function to call itself. These kinds of constructions are referred to as recursive functions.

To learn more about recursive function click here:

brainly.com/question/26781722

#SPJ4

You might be interested in
I will give Brainliest and Extra points for correct answers!!!
AlexFokin [52]
Autauga Alabama 55,869
Baldwin Alabama 223,234
Barbour Alabama 24,686
3 0
3 years ago
Read 2 more answers
Emily is deciding whether to buy the same designer jacket her friends have. The jacket is much more expensive than a similar one
Galina-37 [17]
Is advertising influencing her?
What are her motivations?
Has she compared prices?
Is she buying at the right time?
5 0
3 years ago
Read 2 more answers
Explain steps in creating a main document for from letter. <br>​
Paladinen [302]

Answer:

To create a new database, follow these steps:

1.In the Mail Merge task pane, click Next: Select Recipients.

2.Click Type a new list.

3.Click Create. ...

4.After you type the information for a record, click New Entry to move to the next record. ...

5.In the New Address List dialog box, click OK

4 0
3 years ago
How do I change my username/display name
exis [7]

Answer:

.

Explanation:

you do to me on the bottom bar and once you hit that you click the pencil and change it

6 0
3 years ago
Read 2 more answers
Every call to a recursive function has its own code and its own set of ____ and local variables
777dan777 [17]

Answer: Parameters

Explanation:

Whenever a call to a recursive function is made, then the function has its own code and its own set of parameters with local variables. These parameters are within the scope of the recursive function. For example while finding the factorial of a number we are given the function with parameter such as int recursive(int n) where int n is a parameter passed into the function.

8 0
3 years ago
Other questions:
  • A database on a mobile device containing bands, sub-bands and service provider IDs allowing the device to establish connection w
    9·1 answer
  • Jim is expecting a very busy weekend at his store, so he sent the following e-mail to his employees: ALL EMPLOYEES MUST WORK THI
    6·1 answer
  • Tweaking existing technology in a new way is usually called _____. leveraged creativity state-of-the-art breakthrough applicatio
    5·1 answer
  • Which of the following statements about email is true?
    5·1 answer
  • Which command can be used to find errors on a hard drive​
    6·1 answer
  • A(n) ____ investigation tracks all elements of an attack, including how the attack began, what intermediate devices were used du
    5·1 answer
  • Presentation graphics programs contain an assortment of tools and operations for creating and editing slides, including preforma
    8·2 answers
  • The Advanced Properties sheet enables you to add which of the following?
    15·1 answer
  • Besides your computer, where else can you find and use an operating system?
    11·1 answer
  • What is the core function of an enterprise platform
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!