11.3k views
0 votes
Given a variable s that is associated with the empty string, write some statements that use a while loop to associate s with a string consisting of exactly 777 asterisks (*) .

User Nbrustein
by
4.5k points

1 Answer

5 votes

Answer:

Following are the program in the Python Programming Language.

#declare empty string variable

s=""

#declare variable that store "*" as string

x= "*"

#set the while loop

while(len(s) < 777):

#initialize the value of 'x' in 's'

s= x

x += "*"

Step-by-step explanation:

Following are the description of the program.

  • Set an empty variable to store the string type values.
  • Again, set a variable 'x' and initialize asterisks in it as a string.
  • Set the while loop that iterate, when the length of the variable 's' is less than 777, then initialize the value of the variable 'x' in the variable 's' and concatenate asterisks with the variable 's'.
User Silow
by
4.0k points