Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions bonus-lab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
def pyramidFunction(n):

'''
Docstring for pyramidFunction
this funtion takes a number n and prints a pyramid of numbers with n levels but as a string variable
:param n: the input which determines the size of the pyramid
'''
var4print =""
num =n
for i in range(1, n+1):
for j in range(1, num+1):
var4print += f' {num} '
num -= 1

var4print += "\n"
num = n - i
return var4print

if int(input("chose to use the function or get docs on it, 1 for using the function, 2 for getting docs:")) == 1:
print(pyramidFunction(int(input("enter the number of levels for the pyramid:"))))
elif 2:
print(pyramidFunction.__doc__)
else:
print("invalid input")
23 changes: 23 additions & 0 deletions funcLab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
def pyramidFunction(n):

'''
Docstring for pyramidFunction
this funtion takes a number n and prints a pyramid of numbers with n levels, that is flipped to the right.
:param n: the input which determines the size of the pyramid
'''
num =n
for i in range(1, n+1):
for j in range(1, num+1):
print(f' {num} ',end="")
num -= 1

print("")
num = n - i
#end func

if int(input("chose to use the function or get docs on it, 1 for using the function, 2 for getting docs:")) == 1:
pyramidFunction(int(input("enter the number of levels for the pyramid:")))
elif 2:
print(pyramidFunction.__doc__)
else:
print("invalid input")