I am working on pset6 Mario. When I am running my program it is showing me some errors. But I think my code is correct.
Here is my code:
from cs50 import get_int
row = 0
space = 0
insert = 0
inputspace = 0
def main():
while insert < 1 or insert > 8:
insert = get_int("Enter a number: ")
makepyramid(insert)
def makepyramid(insert):
while (row <= insert):
while (insert < inputspace):
print(".")
inputspace = inputspace + 1
main()
And this is the error I am getting:
Traceback (most recent call last):
File "/home/ubuntu/pset/pset6/mario/mario.py", line 19, in <module>
main()
File "/home/ubuntu/pset/pset6/mario/mario.py", line 9, in main
while insert < 1 or insert > 8:
UnboundLocalError: local variable 'insert' referenced before assignment
Please help me rectify my fault.