Skip to content

Commit 236f6d8

Browse files
author
Sagar Paul
committed
---
1 parent 703b6a6 commit 236f6d8

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

DSA-problems/02.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
n = int(input("Enter upto which digit you want to find Angstrom number: "))
2-
3-
for i in range(1,n+1):
4-
l = len(str(i))
5-
result = 0
6-
a = str(i)
7-
for j in range(l):
8-
result = result + int(a[j])**l
9-
if result == i:
10-
print(i)
11-
1+
'''
2+
*
3+
**
4+
* *
5+
* *
6+
* *
7+
* *
8+
* *
9+
* *
10+
* *
11+
**********
12+
'''
1213

1314

15+
n = int(input("Enter row number: "))
16+
for row in range(n+1):
17+
for col in range(row+1):
18+
if row ==n or col ==0 or col ==row:
19+
print("*",end="")
20+
else:
21+
print(end=" ")
22+
print()
1423

Python Problem Solving/03_Printing Stars in Hollow Right Triangle Shape.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@
1717
print("*"," "*i, "*")
1818
print("*"*n)
1919

20+
'''
21+
22+
n = int(input("Enter row number: "))
23+
for row in range(n+1):
24+
for col in range(row+1):
25+
if row ==n or col ==0 or col ==row:
26+
print("*",end="")
27+
else:
28+
print(end=" ")
29+
print()
30+
31+
'''
32+

0 commit comments

Comments
 (0)