Skip to content

Instantly share code, notes, and snippets.

@dasunsucharith
Created May 18, 2022 02:48
Show Gist options
  • Save dasunsucharith/b64928187dd006bd5235d68cc475955e to your computer and use it in GitHub Desktop.
Save dasunsucharith/b64928187dd006bd5235d68cc475955e to your computer and use it in GitHub Desktop.
CS50 2022 Psets 6 Mario-more Problem Solution
# TODO
from cs50 import get_int
# get input from user until input is correct
while True:
try:
height = get_int("Height: ")
if (height >= 1) and (height <= 8):
break
except:
print("", end="")
for row in range(height):
for space in range(height - row - 1, 0, -1):
print(" ", end="")
# print the left hashes
for left_hash in range(row + 1):
print("#", end="")
# Print the middle seperation spaces
print(" ", end="")
# print the right hashes
for right_hash in range(row + 1):
print("#", end="")
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment