cs50/src6/1/mario3.py

21 lines
343 B
Python

# Prints a column of bricks, catching exceptions
def main():
height = get_height()
for i in range(height):
print("#")
def get_height():
while True:
try:
n = int(input("Height: "))
if n > 0:
return n
except ValueError:
print("Not an integer")
main()