12.4k views
5 votes
create a function that draws a certain number of spaces, followed by a certain number of stars, followed by a newline.

1 Answer

6 votes

Answer:

Step-by-step explanation:

The following code is written in Python and creates a function called create_sentence which takes in 2 parameters which are the number of spaces and the number of stars. Then it uses these values to create the sentence and return it.

def create_sentence(spaces, stars):

sentence = ""

for x in range(spaces):

sentence += " "

for x in range(stars):

sentence += "★"

sentence += "\\"

return sentence

User Secfree
by
3.6k points