Skip to content

Commit e7fadfb

Browse files
authored
Merge pull request openAOD#916 from vaidehisinha1/Answers
Additional Problems
2 parents 59432ae + af6ed84 commit e7fadfb

File tree

10 files changed

+114
-0
lines changed

10 files changed

+114
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
n = int(input("Number of rows: "))
2+
3+
for i in range(n):
4+
for j in range(n - i):
5+
print(chr(65 + j), end="")
6+
print()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
size = int(input("Number of Rows: "))
2+
for i in range(size):
3+
for j in range(1, size - i):
4+
print(" ", end="")
5+
for k in range(i + 1):
6+
print(chr(65 + k), end="")
7+
print()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
size = int(input("Number of rows: "))
2+
3+
for i in range(size):
4+
for j in range(65+size-1,64,-1):
5+
print(chr(j), end=' ')
6+
print()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
rows=int(input("Number of rows = "))
2+
ch = 'A'
3+
4+
for i in range (1,rows+1):
5+
for space in range(rows-i):
6+
print(' ',end='')
7+
8+
for j in range(1, i+1):
9+
print(ch,end="")
10+
ch=ord(ch)+1
11+
ch = chr(ch)
12+
ch=ord(ch)-1
13+
ch = chr(ch)
14+
15+
for k in range(1, i):
16+
ch=ord(ch)-1
17+
ch = chr(ch)
18+
print(ch,end="")
19+
20+
21+
print()
22+
ch='A'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
n = int(input("Number of rows: "))
2+
3+
for i in range(65, 65+n):
4+
for j in range(64, i):
5+
a = chr(i)
6+
print(a, end="")
7+
print()

Numeric Patterns/numericpattern18.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#18 - Numeric Pattern
2+
nums = ['1']
3+
4+
for i in range(12):
5+
nums += ['0', '1']
6+
7+
# Printing 5 nums per loop
8+
i = 0
9+
for _ in range(5):
10+
print(" ".join(nums[i : i + 5]))
11+
i += 5

Pyramid Patterns/pyramidpattern93.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
num = int(input("Enter the Number: "))
2+
3+
for i in range(1, num+1):
4+
for j in range(0, i):
5+
print(" ", end="")
6+
7+
for j in range(1, (num*2 - (2*i - 1))+1):
8+
if i == 1 or j == 1 or j ==(num*2 -(2*i-1)):
9+
print("*", end="")
10+
else:
11+
print(" ", end="")
12+
print()

Symbol Patterns/symbolicpattern103.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
n = int(input("Number of rows: "))
2+
for i in range(n-1, 0, -1):
3+
for j in range(0, i+1):
4+
print("* ", end="")
5+
print("\r")
6+
for i in range(0,n):
7+
for j in range(0, i+1):
8+
print("* " , end="")
9+
print("\r")

Symbol Patterns/symbolicpattern104.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
n = int(input("Number of rows: "))
2+
k = -1
3+
for i in range(n-1,-1,-1):
4+
for j in range(k,-1,-1):
5+
print(end=" ")
6+
k = k + 2
7+
for j in range(0, i+1):
8+
print("* ", end="")
9+
print("\r")
10+
k = 2 * n - 2
11+
for i in range(1, n):
12+
for j in range(2, k):
13+
print(end=" ")
14+
k = k - 2
15+
for j in range(0, i + 1):
16+
print("* ", end="")
17+
print("\r")

Symbol Patterns/symbolicpattern93.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
n = int(input("Number of rows: "))
2+
k = 2 * n - 2
3+
for i in range(0,n):
4+
for j in range(0,k):
5+
print(end=" ")
6+
k = k - 1
7+
for j in range(0, i+1):
8+
print("*", end=" ")
9+
print("\r")
10+
k = n - 2
11+
for i in range(n-2, -1 , -1):
12+
for j in range(k , -2 , -1):
13+
print(end=" ")
14+
k = k + 1
15+
for j in range(0, i+1):
16+
print("* " , end="")
17+
print("\r")

0 commit comments

Comments
 (0)