-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplus_star_pattern.py
More file actions
42 lines (28 loc) · 849 Bytes
/
Copy pathplus_star_pattern.py
File metadata and controls
42 lines (28 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'''
let's write a program to print plus star pattern or plus of stars
*
*
* * * * *
*
*
like this
logic:
loop1(variable i): iterate through rows
loop2(varivable j ): print stars or space
we will first print a squre and then make that into a plus
we will print star only if i == row//2+1 or j == row//2+1 else print spaces
'''
row = int(input("enter the number of rows: "))
for i in range(1, row+1):
for j in range(1, row+1):
#print stars only if this logic is true
if i == row//2+1 or j == row//2+1:
print("*",sep=" ", end=" ")
else:
#else print spaces
print(" ", sep=" ", end=" ")
print() #new line
'''
we have a square now let make it into plus pattern
thank you for watching
'''