-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise.py
102 lines (88 loc) · 1.6 KB
/
exercise.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# rows = 5
# i = 1
# while i <= rows:
# j = 1
# while j <= i:
# print((i * 2 - 1), end=" ")
# j = j + 1
# i = i + 1
# print('')
#
# print('\n')
# x=input("enter symbol: ")
# n= int(input("enter a number: "))
# for i in range(n):
# print(x*n)
# 1
# 2 2
# 3 3 3
# 4 4 4 4
# 5 5 5 5 5
# print("Row i value print it")
# a=int(input("Enter number: "))
# for i in range(1,a+1):
# for j in range(1,i+1):
# print(i,end=" ")
# print()
# 1
# 1 2
# 1 2 3
# 1 2 3 4
# 1 2 3 4 5
# n=int(input("enter: "))
# for i in range(n+1):
# for j in range(1,i+1):
# print(j,end=" ")
# print()
# a,b=0,1
# for i in range(n):
# for j in range(i+1):
# c=a+b
# a=b
# b=c
# print(c,end=" ")
# print()
# a=0
# b=0
# for i in range(n):
# for j in range(i+1):
# c=a+b
# if b==0 or a==0:
# b=1
# a=b
# b=c
# print(c,end=" ")
# print()
# a = 0
# b = 1
# for i in range(n):
# for j in range(i+1):
# print(a, end=" ")
# c = a + b
# a = b
# b = c
# print()
n = int(input())
# n=k+1
a=0
b=1
for i in range(0, n+1):
for j in range(0, n - i):
print(" ", end="")
for j in range(0, i + 1):
print(a, end=" ")
c = a + b
a = b
b = c
print()
# n = n - 1
# n = k+1
for i in range(0, n):
for j in range(0, i+1):
print(" ", end="")
for j in range(0, n - i):
print(a, end=" ")
c = a + b
a = b
b = c
print()