-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path29_Exercise.py
More file actions
47 lines (43 loc) · 966 Bytes
/
Copy path29_Exercise.py
File metadata and controls
47 lines (43 loc) · 966 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
43
44
45
46
47
# Pattern printing
# Input = Integer n
# Boolean = true or false
# True n = 5
# *
# **
# ***
# *****
# False n = 5
# *****
# ***
# **
# *
# print("How many rows you want to print")
# a = int(input())
# print("type 1 or 0")
# b = int(input())
# new = bool(b)
# if new == True:
# for i in range(1,a+1):
# for j in range(1,i+1):
# print("*",end=" ")
# print()
# elif new == False:
# for i in range(a,0,-1):
# for j in range(1,i+1):
# print("*",end = " ")
# print()
a = int(input("How many rows do you want to print"))
b = int(input("Type 1 or 0"))
new = bool(b)
if new == True:
for i in range(1,a+1):
for j in range(1,i+1):
print("*",end=" ")
print()
elif new == False:
for i in range (a,0,-1):
for j in range(1,i+1):
print("*",end=" ")
print()
else:
print("Write 1 or 0 only")