daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Dec 19th, 2018 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Python3
  2.  
  3. #Example 1
  4. for i in range(-3,4):
  5.     print('*'+(' '*abs(i**2-3))+'*') if i>-3 and i<3  else print('*')
  6.  
  7.  
  8. #Skip Lines  
  9. print('\n\n')
  10. #Example 2
  11. for i in range(-2,3):
  12.     print((' '*abs(i*2))+'*'+(' '*(-(abs(4*i))+7))+'*') if i>-2 and i<2 else print((' '*abs(i)*2)+'*')
  13.  
  14.  
  15. #Skip Lines
  16. print('\n\n')
  17. #Alternate approach to Example 1
  18. a=['*']*7
  19. for i in range(0,len(a)-1):
  20.     a[i+1] = '*'+(' '*(i+1))+'*'
  21.     if i>3: a[i]= '*'+(' '*(6-i))+'*'
  22.     print(a[i])
  23.     if i==5: print('*')
  24.  
  25.  
  26.  
  27. #Output
  28. """
  29. *
  30. * *
  31. *  *
  32. *   *
  33. *  *
  34. * *
  35. *
  36.  
  37.  
  38.  
  39.     *
  40.   *   *
  41. *       *
  42.   *   *
  43.     *
  44.  
  45.  
  46.  
  47. *
  48. * *
  49. *  *
  50. *   *
  51. *  *
  52. * *
  53. *
  54.  
  55. """
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top