forked from vipinkjonwal/pythonCodes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvTriangle.py
More file actions
29 lines (25 loc) · 725 Bytes
/
invTriangle.py
File metadata and controls
29 lines (25 loc) · 725 Bytes
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
def invertedTriangle(numberRows):
'''
Objective : To print an inverted triangle.
Input Parameters :
numberRows : integer-Number of rows inputted by user.
Return value : none
'''
#Approach : Use of 'while' loop to print the triangle.
numberSpaces=0
numberStars=2*numberRows-1
while numberStars>0:
print(' '*numberSpaces,'*'*numberStars)
numberStars-=2
numberSpaces+=1
def main():
'''
Objective : To print an inverted triangle.
Input Parameters : none
Return value : none
'''
#Approach : Invoke the function rightTriangle.
numberRows=int(input('Enter the number of rows: '))
invertedTriangle(numberRows)
if __name__ == '__main__':
main()