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
zzz [600]
3 years ago
7

Assume the availability of a function called printStars. The function receives an integer value as an argument. If the argument

is positive, the function prints (to standard output) the given number of asterisks. Thus, if printStars(8) is called, ******** (8 asterisks) will be printed.Assume further that the variable starCount has been declared and initialized to contain a positive integer value.Write some code that prints starCount asterisks to standard output by:first printing a single asterisk and no other characters then calls printStars to print the remaining asterisks.Hint: Make sure to use the "end" option for print characters without the default newline, e.g. print("hello", end="")
Computers and Technology
1 answer:
Luda [366]3 years ago
5 0

Answer:

The solution code is written in Python 3.

  1. def printStars(count):
  2.    for i in range(0, count):
  3.        print("*", end="")
  4. starCount = 8
  5. print("*", end="")
  6. printStars(starCount-1)

Explanation:

Firstly, create a function <em>printStars()</em> that take one integer value as argument. (Line 1 -3)

  • To print the asterisks based on the input integer, <em>count</em>, we can use the for-loop and Python in-built method <em>range() </em>(Line 2-3)
  • The range() method will accept two arguments, start index and stop index, which will control the number of iterations the for-loop will go through. If the count = 5, the for-loop will traverse through the range of number from 0, 1, 2, 3, 4 (A total of 5 rounds of iterations).

Once the function <em>printStars()</em> is ready, create a variable <em>starCount and </em>initialize it with 8 (Line 5).

Print the first asterisk (Line 6) and then followed with calling the function <em>printStars() </em>to print the remaining asterisk (Line 7). The argument that passed to the <em>printStarts()</em> function is <em>starCount-1 </em>as the first asterisk has been printed in Line (6).

You might be interested in
It is considered good practice to save a presentation before printing it. true false
Ilya [14]
It is true because it is really a good practise to save a presentation before printing it

5 0
3 years ago
Which of the following best describes professional behavior in the IT field?
Liono4ka [1.6K]
Option A. is the correct answer the other three are not professional behaviour if you would like an explanation as to why they are not just comment
7 0
3 years ago
Read 2 more answers
All computers can support multiple internal hard drives. <br><br> a. True <br><br> b. False
lara31 [8.8K]
False.  Some can, but some do not have space for them.  Please mark Brainliest!!!
5 0
4 years ago
(--BRAINLIEST--)<br>Explain the types of secondary memory on the basis of data access.​
Nina [5.8K]

There are two types of secondary memories.

  1. RAM
  2. ROM

RAM:

  • RAM stands for random access memory .
  • It is expandable.
  • we can do multiple things in it.
  • Its erasable.

ROM

  • ROM stands for read only memory.
  • It is permanent .
  • We can only read in it.
  • Its permanent hence not removable.
8 0
3 years ago
Read 2 more answers
What feature did the 32X add to the Sega Genesis?
il63 [147K]

Answer:

ngl why would i know this

Explanation:

5 0
3 years ago
Other questions:
  • Trojan Horse is a malicious program and a virus is a program. <br><br> a. True <br> b. False
    6·1 answer
  • One of the ways to create a horizontal navigation menu from an unordered list is to a. set the display property of the element w
    6·1 answer
  • Im being timed please help!!
    7·2 answers
  • What kind of energy transformation occurs in a gasoline-powered car?
    14·1 answer
  • Generally considered to be the most important information security policies, what item below defines the actions a user may perf
    11·1 answer
  • Which is the oldest of the following sports?
    6·2 answers
  • Which Python expression results in 49?<br><br> 7 * 2<br><br> 7^2<br><br> 7 // 2<br><br> 7 ** 2
    12·2 answers
  • When planning your App what difficulties did come across and why?
    5·2 answers
  • WHAT ACTIONS CAUSE SPAM ON LINKEDIN?
    5·1 answer
  • Q.3.1 Explain why devices on a network need addresses. (5)​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!