Friday 25 December 2020

Pattern based on given value of N

Python while loop

Pattern based on given value of N.

Sample output for N=5

* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

Python Code:

number = int(input("Enter number of lines to be printed: "))
count = 0
while count < number:
  print(" * * * * * ")
  count = count + 1

Output of program

Enter number of lines to be printed: 5
 * * * * * 
 * * * * * 
 * * * * * 
 * * * * * 
 * * * * * 



No comments:

Post a Comment