-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuilding_dev_asmt2.py
88 lines (78 loc) · 1.51 KB
/
Building_dev_asmt2.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#Building_dev
#Assingments
num = int(input("Enter a number: "))
def asmt_1():
print("\nAssignment 1\n")
for i in range(num):
print(" "*((num-i)//2) +"*"*(i+1))
return ""
print(asmt_1())
def asmt_2():
print("".center(50,"_"))
print("\nAssignment 2\n")
for i in range(num):
print("*"*(i+1))
print()
return ""
print(asmt_2())
def asmt_3():
print("".center(50,"_"))
print("\nAssignment 3\n")
#rows
for i in range(num):
#1st square
#colums
for j in range(num):
#anti diagonal
if j+i ==num-1:
print("*",end= " ")
else:
print(" ", end= " ")
#2nd square
for j in range(i):# rm j=0 column
if j==i-1:#new diagonal
print("*",end=" ")
else:
print(" ",end=" ")
print()
return ""
print(asmt_3())
def asmt_4():
print("".center(50,"_"))
print("\nAssignment 4\n")
for i in range(num):
for j in range(num):
if j+i==num-1:
print("*",end=" ")
elif j==num-1:
print(i,end=" ")
else:
print(" ",end=" ")
for j in range(i):
if j==i-1:
print("*",end=" ")
else:
print(" ",end=" ")
print()
return ""
print(asmt_4())
def asmt_5():
print("".center(50,"_"))
print("\nAssignment 5\n")
for i in range(num):
for j in range(num):
if j+i==num-1:
print("*",end=" ")
elif j==num-1:
print(((num+1)-i),end=" ")
else:
print(" ",end=" ")
for j in range(i):
if j==i-1:
print("*",end=" ")
else:
print(" ",end=" ")
print()
#runs the nxt iteration of main for loop on the next line
return ""
print(asmt_5())