Maintenance Mode

Have Patience Working on it

Pattern 1

 


Print Pattern 1

 the square formed of stars

We will use the rows and columns of a matrix system to print our pattern.

def pattern1():
# loop for rows
for x in range(1, 6): # can also take reverse (5, 0, -1)
# loop to print stars
for y in range(1, 6): # can also take in revers (5, 0, -1)
print("*", end=" ")
# after printing stars
print() # move to next line
# end = " " this will prevent print function to move to next line
# range() you can take any numbers to create a range of 5 numbers
# -ve range example showed you will in our next patterns
pattern1()
view raw Pattern1.py hosted with ❤ by GitHub
Pattern 1 Pattern 1 Reviewed by Leaf Code on August 09, 2020 Rating: 5

No comments:

SET ADT Using Students courses example

Powered by Blogger.