We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17331b2 commit 80478dbCopy full SHA for 80478db
Python_Begginer_Projects/Shapes/right_angle_tringle.py
@@ -0,0 +1,27 @@
1
+def Square(s):
2
+ for i in range(s):
3
+ if i == 0: # First row
4
+ print('*')
5
+ elif i == s - 1: # Last row
6
+ print('* ' * s)
7
+ else: # Middle rows
8
+ print('*' + ' ' * (2 * i - 1) + '*')
9
+def check_length():
10
+ while True:
11
+ length = input('Enter the length of the triangle: ')
12
+ if length.isdigit():
13
+ length = int(length)
14
+ if length > 1:
15
+ Square(length)
16
+ else:
17
+ print('Length must be greater than one.')
18
19
+ print('Please enter a digit.')
20
+
21
22
+check_length()
23
24
+if __name__ == '__main__':
25
+ check_length()
26
27
0 commit comments