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
Which of the following statements is true of San serif fonts?
Vsevolod [243]
They are easier to read on a computer screen
7 0
3 years ago
Read 2 more answers
3. What are the first steps that you should take if you are unable to get onto the Internet? (1 point)
slavikrds [6]

Answer:

Check your router connections then restart your router.

Explanation:

When the internet connection is not displaying properly then the first step is to check the router. The network icon on the internet displays the availability of internet. Adjust the router and see if the router is working properly. If not restart the router so that it adjusts its settings to default. The connection will be available on the computer and internet will start working normally.

3 0
4 years ago
TRUE OR FALSE, databases allow you to search for content on the internet based on certain criteria (PLS ANSWER RIGHT)
tester [92]

I'm pretty sure the answer is true. If the criteria it means is like the text you search and the like, then it's true. If this helped, please give me brainiest!

7 0
4 years ago
Read 2 more answers
Two resistors of 10 ohms and 40 ohms are connceted in parallel . A third of 5 ohm is connected in series with the combination an
Rasek [7]

Answer:

please mark me as brilliant and answer my questions

8 0
3 years ago
Operating systems of mobile devices can support full-scale software like microsoft word or excel
bezimeni [28]
Operating systems of mobile devices can support full-scale software like microsoft word or excel

not all mobile divices can but yes they can support it especially on tablets
8 0
4 years ago
Other questions:
  • 4. In Microsoft Word you can access the _______ command from the "Mini toolbar".
    14·1 answer
  • Assume you're using a three button mouse. to access shortcut menus, you would
    9·2 answers
  • What invention changed the nature of communication and commerce in the first half of the nineteenth century?
    13·2 answers
  • Select the examples that best demonstrate likely employers for Journalism and Broadcasting workers. Check all that apply.
    11·2 answers
  • Which are technical and visual demands<br> that need to be considered when<br> planning a project?
    6·1 answer
  • Somebody pls help!!! i don’t know what i did but i don’t know how to fix it
    8·1 answer
  • Write a program that asks the user to guess the next roll of a six-sided die. Each guess costs $ 1. If they guess correctly, the
    8·1 answer
  • In what ways is the human brain like a computer? In what ways is it different?
    14·2 answers
  • GoodArray hackerrank solution for a number N, a goodArray is the smallest possible array that consists of only powers of two
    9·1 answer
  • Ntering a system call involves changing from kernel mode to user mode.<br><br> a. true <br> b. false
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!