joseleeph

Untitled

Nov 26th, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from cs50 import get_int
  2.  
  3. def main():
  4. #n = get_positive_int("enter a positive integer")
  5. num = get_positive_int()
  6. pyrprint(num)
  7. def get_positive_int():
  8. n = get_int("Height : ")
  9. while n < 1 or n > 8:
  10. n = get_int("Height : ")
  11. return n;
  12. def pyrprint(height):
  13. hashes = 1
  14. spaces = height-hashes
  15. while hashes <= height:
  16. print(" "*spaces,end = "")
  17. print("#"*hashes, end = "")
  18. print(" ", end = "")
  19. print("#"*hashes)
  20. hashes += 1
  21. spaces -= 1
  22. main()
Advertisement
Add Comment
Please, Sign In to add comment