Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. '''
  2. Use turtle graphics to draw a Bananarama CS 1
  3.  
  4. File: Lab_01.py
  5. author: Harrison Worden
  6. created: August 2015
  7. '''
  8.  
  9. from turtle import *
  10.  
  11. def init():
  12. '''
  13. Initializes the turtle to start facing the north
  14. '''
  15. left(90)
  16.  
  17.  
  18.  
  19.  
  20. def drawB():
  21. '''
  22. Commands the turtle to draw a B
  23. '''
  24. forward(30)
  25. right(90)
  26. forward(20)
  27. right(90)
  28. forward(15)
  29. right(90)
  30. forward(20)
  31. back(30)
  32. left(90)
  33. forward(15)
  34. right(90)
  35. forward(30)
  36. back(30)
  37. left(90)
  38. up()
  39. left(90)
  40. forward(5)
  41. left(90)
  42. down()
  43.  
  44.  
  45. def drawA():
  46. '''
  47. Commands the turtle to draw an A
  48. '''
  49. forward(30)
  50. right(90)
  51. forward(30)
  52. right(90)
  53. forward(15)
  54. right(90)
  55. forward(30)
  56. back(30)
  57. left(90)
  58. forward(15)
  59. up()
  60. left(90)
  61. forward(5)
  62. left(90)
  63. down()
  64.  
  65.  
  66.  
  67. def drawN():
  68. '''
  69. Commands the turtle to draw a N
  70. '''
  71. forward(30)
  72. right(90)
  73. right(45)
  74. forward(42.4264)
  75. left(45)
  76. left(90)
  77. forward(30)
  78. back(30)
  79. up()
  80. right(90)
  81. forward(5)
  82. left(90)
  83. down()
  84.  
  85.  
  86.  
  87. def drawR():
  88. '''
  89. Commands the turtle to draw a R
  90. '''
  91. forward(30)
  92. right(90)
  93. forward(30)
  94. right(90)
  95. forward(20)
  96. right(90)
  97. forward(30)
  98. right(90)
  99. right(90)
  100. right(18)
  101. forward(31.662)
  102. up()
  103. left(18)
  104. forward(5)
  105. left(90)
  106. down()
  107.  
  108.  
  109.  
  110. def drawM():
  111. '''
  112. Commands the turtle to draw a M
  113. '''
  114. forward(30)
  115. right(90)
  116. right(90)
  117. left(26.5650)
  118. forward(33.541)
  119. right(26.5650)
  120. right(90)
  121. right(90)
  122. right(26.5650)
  123. forward(33.541)
  124. left(26.5650)
  125. left(90)
  126. left(90)
  127. forward(30)
  128. up()
  129. left(90)
  130. forward(5)
  131. left(90)
  132. down()
  133.  
  134.  
  135.  
  136. def drawC():
  137. '''
  138. Commands the turtle to draw a C
  139. '''
  140. up()
  141. right(90)
  142. forward(10)
  143. left(90)
  144. down()
  145. forward(30)
  146. right(90)
  147. forward(30)
  148. up()
  149. right(90)
  150. forward(30)
  151. left(90)
  152. down()
  153. back(30)
  154. forward(30)
  155. up()
  156. forward(5)
  157. left(90)
  158. down()
  159.  
  160.  
  161.  
  162. def drawS():
  163. '''
  164. commands the turtle to draw a S
  165. '''
  166. right(90)
  167. forward(30)
  168. left(90)
  169. forward(15)
  170. left(90)
  171. forward(30)
  172. right(90)
  173. forward(15)
  174. right(90)
  175. forward(30)
  176. up()
  177. left(90)
  178. back(30)
  179. right(90)
  180. forward(10)
  181. left(90)
  182. down()
  183.  
  184.  
  185.  
  186. def draw1():
  187. '''
  188. Commands the turtle to draw a 1
  189. '''
  190. right(90)
  191. forward(15)
  192. forward(15)
  193. back(15)
  194. left(90)
  195. forward(30)
  196. left(90)
  197. left(45)
  198. forward(10)
  199. back(10)
  200. right(45)
  201. right(90)
  202. back(30)
  203. right(90)
  204. forward(15)
  205. up()
  206.  
  207.  
  208.  
  209. def drawbananaramacs1():
  210. '''
  211. Commands the turtle to draw out the phrase BANANARAMA CS 1
  212. '''
  213. init()
  214. drawB()
  215. drawA()
  216. drawN()
  217. drawA()
  218. drawN()
  219. drawA()
  220. drawR()
  221. drawA()
  222. drawM()
  223. drawA()
  224. drawC()
  225. drawS()
  226. draw1()
  227.  
  228.  
  229. drawbananaramacs1()
  230.  
  231. input('Hit Enter to close...')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement