Assume the availability of a function called printStars. The function receives an int 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 a some integer, possibly negative or zero. Write some code that does nothing if starCount is not positive but that otherwise prints starCount asterisks to standard output by: first printing a single asterisk (and no other characters) then calls printStars to print the remaining asterisks.

Respuesta :

Answer:

The python program is given with appropriate comments

Explanation:

#Implementation of printStars function

def printStars(n):

  #check if n is greater than 0

  if n>0:

      for i in range(n):

          print ('*', end="")

#Declare starCount and initialize some negative integer

starCount = -8

if starCount>0:

   print ('*', end="")

   printStars(starCount-1)