Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from cs50 import get_int
- def main():
- #n = get_positive_int("enter a positive integer")
- num = get_positive_int()
- pyrprint(num)
- def get_positive_int():
- n = get_int("Height : ")
- while n < 1 or n > 8:
- n = get_int("Height : ")
- return n;
- def pyrprint(height):
- hashes = 1
- spaces = height-hashes
- while hashes <= height:
- print(" "*spaces,end = "")
- print("#"*hashes, end = "")
- print(" ", end = "")
- print("#"*hashes)
- hashes += 1
- spaces -= 1
- main()
Advertisement
Add Comment
Please, Sign In to add comment