Advertisement
SimeonTs

SUPyF2 Basic - 05. Patterns

Sep 19th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. """
  2. Basic Syntax, Conditional Statements and Loops - Lab
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1718#4
  4. Video: https://www.youtube.com/watch?v=sP_t7cbZF7c
  5.  
  6. SUPyF2 Basic - 05. Patterns
  7.  
  8. Problem:
  9. Write a program to create the following pattern:
  10. *
  11. **
  12. ***
  13. **
  14. *
  15. You will receive a number that represents the highest number of stars.
  16.  
  17. Examples:
  18.  
  19.    Input:
  20. 3
  21.    Output:
  22. *
  23. **
  24. ***
  25. **
  26. *
  27.  
  28. Input:
  29. 5
  30. Output:
  31. *
  32. **
  33. ***
  34. ****
  35. *****
  36. ****
  37. ***
  38. **
  39. *
  40. """
  41. stars = int(input())
  42.  
  43. for star in range(1, stars + 1):
  44.     for second_star in range(0, star):
  45.         print("*", end="")
  46.     print()
  47. for star in range(stars - 1, 0, -1):
  48.     for second_star in range(0, star):
  49.         print("*", end="")
  50.     print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement