I've been trying a while now but i just can't seem to get it right. I'm a starting programmer and have to do an assignment for school. The program should ask the user for a number and print a diamond shape, based on this number. Now I've got it working fine.. but I have print statements outside my main. How do i get this inside my main?
my code:
def loop(start, eind, step, ei):
for a in range (start, eind, step):
for b in range(a):
print(" ", end="")
for c in range(ei+1, a, -1):
print(a, end="")
for d in range(a, ei):
print(a, end="")
print("")
def main():
print("Welcome! :) ")
loop(y,0,-1,y)
loop(2,y+1,1,y)
Hope you guys can help me out! By the way, I've got more code for this program but that's not relevant (like asking the user for "y").