Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python Mario again!
# create a mario pyramid in python!
from cs50 import get_int
def main():
# Prompt user for a positive number
while True:
n = get_int("enter a positive number: ")
if n > 0:
break
# Print out this many rows
for i in range(n):
# Print out this many columns
for j in range(n-(i+1)):
print(" ", end="")
for k in range(i+1):
print("#", end="")
print(" ", end="")
for l in range(i+1):
print("#", end="")
print()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment