Last active
January 19, 2021 22:56
-
-
Save sojohnnysaid/e57c28a9946ebc4dffdc3a68e1777d55 to your computer and use it in GitHub Desktop.
Python Mario again!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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