Guest User

Untitled

a guest
Aug 23rd, 2019
83
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 8,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "# Import the library\n",
  10. "\n",
  11. "import matplotlib.pyplot as plt\n",
  12. "%matplotlib inline "
  13. ]
  14. },
  15. {
  16. "cell_type": "code",
  17. "execution_count": 11,
  18. "metadata": {},
  19. "outputs": [],
  20. "source": [
  21. "# create a circle\n",
  22. "\n",
  23. "class Circle(object):\n",
  24. " \n",
  25. " #constructor\n",
  26. " def __init__(self, radius=3, color='blue'):\n",
  27. " self.radius = radius\n",
  28. " self.color = color \n",
  29. " \n",
  30. " # Method\n",
  31. " def add_radius(self, r):\n",
  32. " self.radius = self.radius + r\n",
  33. " return(self.radius)\n",
  34. " \n",
  35. " # Method\n",
  36. " def drawCircle(self):\n",
  37. " plt.gca().add_patch(plt.Circle((0, 0), radius=self.radius, fc=self.color))\n",
  38. " plt.axis('scaled')\n",
  39. " plt.show() "
  40. ]
  41. },
  42. {
  43. "cell_type": "code",
  44. "execution_count": 12,
  45. "metadata": {},
  46. "outputs": [],
  47. "source": [
  48. "# Create an object RedCircle\n",
  49. "\n",
  50. "RedCircle = Circle(10, 'red')"
  51. ]
  52. },
  53. {
  54. "cell_type": "code",
  55. "execution_count": 13,
  56. "metadata": {},
  57. "outputs": [
  58. {
  59. "data": {
  60. "text/plain": [
  61. "['__class__',\n",
  62. " '__delattr__',\n",
  63. " '__dict__',\n",
  64. " '__dir__',\n",
  65. " '__doc__',\n",
  66. " '__eq__',\n",
  67. " '__format__',\n",
  68. " '__ge__',\n",
  69. " '__getattribute__',\n",
  70. " '__gt__',\n",
  71. " '__hash__',\n",
  72. " '__init__',\n",
  73. " '__init_subclass__',\n",
  74. " '__le__',\n",
  75. " '__lt__',\n",
  76. " '__module__',\n",
  77. " '__ne__',\n",
  78. " '__new__',\n",
  79. " '__reduce__',\n",
  80. " '__reduce_ex__',\n",
  81. " '__repr__',\n",
  82. " '__setattr__',\n",
  83. " '__sizeof__',\n",
  84. " '__str__',\n",
  85. " '__subclasshook__',\n",
  86. " '__weakref__',\n",
  87. " 'add_radius',\n",
  88. " 'color',\n",
  89. " 'drawCircle',\n",
  90. " 'radius']"
  91. ]
  92. },
  93. "execution_count": 13,
  94. "metadata": {},
  95. "output_type": "execute_result"
  96. }
  97. ],
  98. "source": [
  99. "# Find out the methods can be used on the object RedCircle\n",
  100. "\n",
  101. "dir(RedCircle)"
  102. ]
  103. },
  104. {
  105. "cell_type": "code",
  106. "execution_count": 14,
  107. "metadata": {},
  108. "outputs": [
  109. {
  110. "data": {
  111. "text/plain": [
  112. "10"
  113. ]
  114. },
  115. "execution_count": 14,
  116. "metadata": {},
  117. "output_type": "execute_result"
  118. }
  119. ],
  120. "source": [
  121. "# Print the object attribute radius\n",
  122. "\n",
  123. "RedCircle.radius"
  124. ]
  125. },
  126. {
  127. "cell_type": "code",
  128. "execution_count": 15,
  129. "metadata": {},
  130. "outputs": [
  131. {
  132. "data": {
  133. "text/plain": [
  134. "'red'"
  135. ]
  136. },
  137. "execution_count": 15,
  138. "metadata": {},
  139. "output_type": "execute_result"
  140. }
  141. ],
  142. "source": [
  143. "# Print the object attribute color\n",
  144. "\n",
  145. "RedCircle.color"
  146. ]
  147. },
  148. {
  149. "cell_type": "code",
  150. "execution_count": 16,
  151. "metadata": {},
  152. "outputs": [
  153. {
  154. "data": {
  155. "text/plain": [
  156. "1"
  157. ]
  158. },
  159. "execution_count": 16,
  160. "metadata": {},
  161. "output_type": "execute_result"
  162. }
  163. ],
  164. "source": [
  165. "# Set the object attribute radius\n",
  166. "\n",
  167. "RedCircle.radius = 1\n",
  168. "RedCircle.radius"
  169. ]
  170. },
  171. {
  172. "cell_type": "code",
  173. "execution_count": 17,
  174. "metadata": {},
  175. "outputs": [
  176. {
  177. "data": {
  178. "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQ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czeiMYmTQ0z29/Mnjaz16PH/fIst9bMlpvZEjNLxd17HX2u5t0azV9mZkNDxNmRAvbjVDPbEn32S8xsUog422Nm08xsk5mtyDO/878L51xmJvyo6EfjxxptyLNMLbAaOALoCiwFBoaOvVV8NwLXRc+vA/41z3JrgZ6h4y3mcwXOAebgR3M7AXgpdNyd3I9TgcdCx9rBfpwMDAVW5Jnf6d9FploazrlVzrlXO1js44GOnXMfAs0DHafFefhBlokePx8wlmIU8rmeB8xw3ovAvtGIbWmS9r+PgjjnFgCb21mk07+LTCWNAuUa6PjgQLHksttgy0C+wZYd8JSZNUaDLodWyOea9s8eCo/xRDNbamZzzOwzyYQWq07/LpIYjTxWaRnouBTt7UMRmxnhnNsYjeD+tJm9Ev13CaWQzzX4Z1+AQmJ8GX9vxvtmdg7wCNC/7JHFq9O/i4pLGq68Ax0nor19MLOCBlt2zm2MHjeZ2Ux8szpk0ijkcw3+2Regwxidc1tbPX/CzG43s57OuUq6ma3Tv4tqPDxpb6DjNOhwsGUz29vMejQ/B84GcvaSJ6iQz3UWcHHUc38CsKX5UCxFOtwPMzvIogphZjYc/z16N/FIS9P530XoXt6Ye4zPx2fQPwNvA3Oj1/sCT7TpOX4N30v+ndBxt9mHA4Bngdejx/3b7gO+Z39pNK1Myz7k+lyBicDE6LkBP4nmLyfPGa7QUwH7cVX0uS8FXgROCh1zjn14AGgCdkTfib+L63ehy8hFpCjVeHgiIiVQ0hCRoihpiEhRlDREpChKGiJSFCUNESmKkoaIFOX/AedMnxeNoYEkAAAAAElFTkSuQmCC\n",
  179. "text/plain": [
  180. "<Figure size 432x288 with 1 Axes>"
  181. ]
  182. },
  183. "metadata": {
  184. "needs_background": "light"
  185. },
  186. "output_type": "display_data"
  187. }
  188. ],
  189. "source": [
  190. "# Call the method drawCircle\n",
  191. "\n",
  192. "RedCircle.drawCircle()"
  193. ]
  194. },
  195. {
  196. "cell_type": "code",
  197. "execution_count": 18,
  198. "metadata": {},
  199. "outputs": [
  200. {
  201. "name": "stdout",
  202. "output_type": "stream",
  203. "text": [
  204. "Radius of object: 1\n",
  205. "Radius of object of after applying the method add_radius(2): 3\n",
  206. "Radius of object of after applying the method add_radius(5): 8\n"
  207. ]
  208. }
  209. ],
  210. "source": [
  211. "# Use method to change the object attribute radius\n",
  212. "\n",
  213. "print('Radius of object:',RedCircle.radius)\n",
  214. "RedCircle.add_radius(2)\n",
  215. "print('Radius of object of after applying the method add_radius(2):',RedCircle.radius)\n",
  216. "RedCircle.add_radius(5)\n",
  217. "print('Radius of object of after applying the method add_radius(5):',RedCircle.radius)"
  218. ]
  219. },
  220. {
  221. "cell_type": "code",
  222. "execution_count": 19,
  223. "metadata": {},
  224. "outputs": [],
  225. "source": [
  226. "# Create a blue circle with a given radius\n",
  227. "\n",
  228. "BlueCircle = Circle(radius=100)"
  229. ]
  230. },
  231. {
  232. "cell_type": "code",
  233. "execution_count": 20,
  234. "metadata": {},
  235. "outputs": [
  236. {
  237. "data": {
  238. "text/plain": [
  239. "100"
  240. ]
  241. },
  242. "execution_count": 20,
  243. "metadata": {},
  244. "output_type": "execute_result"
  245. }
  246. ],
  247. "source": [
  248. "# Print the object attribute radius\n",
  249. "\n",
  250. "BlueCircle.radius"
  251. ]
  252. },
  253. {
  254. "cell_type": "code",
  255. "execution_count": 21,
  256. "metadata": {},
  257. "outputs": [
  258. {
  259. "data": {
  260. "text/plain": [
  261. "'blue'"
  262. ]
  263. },
  264. "execution_count": 21,
  265. "metadata": {},
  266. "output_type": "execute_result"
  267. }
  268. ],
  269. "source": [
  270. "# Print the object attribute color\n",
  271. "\n",
  272. "BlueCircle.color"
  273. ]
  274. },
  275. {
  276. "cell_type": "code",
  277. "execution_count": 22,
  278. "metadata": {},
  279. "outputs": [
  280. {
  281. "data": {
  282. "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQoAAAD4CAYAAAAU5qhvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbW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EFojIFhFZk7asxbo79F5S1UTecCN/HwU8DZSnLR8BrAKKgaG4S9m7BM+9hLskXnCXt4/3/TqavKZrge9mWN7ia4rbDegS1HcE0C2oe4TvutpY+2agb5NlPwauDr6+GrjJd50Z6j4Z+CSwJlvdHX0vJbZFoaprVXV9hqf+PrCvqr6JG/dijIiUEgzsq+43lhrYNwkyvibPNbVkDLBJVd9Q1d3AQlz9STUJuCf4+h5i+J5R1WeBbU0Wt1R3h95LiQ2KVhwKvJP2ODWA76G0Y2Bfjy4TkdVBczLVXGzpNcVRkmptSoEnRKQ6GNgZYIC6kdkI7vt7q659Wqq7Q3+fWE9S7HNg36i09ppwc578EFfXD4E5wIXEpPY2SlKtTZ2kqnUi0h9YLiLrfBcUgQ79fWIdFJqHA/u29TWJyHzg18HDll5THCWp1o9Q1brgfouIPIprkjeISKmq1ge7r1u8Ftl2LdXdob9PPu56JHZg3+APmjIZNxMbtPCacl1fG70MHCkiQ0WkG27GuErPNWUlIgeJSI/U18CpuN9/JTAt+LZpxOw904qW6u7Ye8l3j20nenon49JxF9AALEt7bhauN3c9aUc2gHLcH78GuI3gzNS43ID7gFeB1cEftDTba4rjDZgAbAjqneW7njbWfATuaMAq4LVU3UAf4ElgY3Df23etGWp/AKhn/wRb/9Ja3R15L9kp3MaYrPJx18MYEzILCmNMVhYUxpisLCiMMVlZUBhjsrKgMMZkZUFhjMnq/wHBJHawQti6dgAAAABJRU5ErkJggg==\n",
  283. "text/plain": [
  284. "<Figure size 432x288 with 1 Axes>"
  285. ]
  286. },
  287. "metadata": {
  288. "needs_background": "light"
  289. },
  290. "output_type": "display_data"
  291. }
  292. ],
  293. "source": [
  294. "# Call the method drawCircle\n",
  295. "\n",
  296. "BlueCircle.drawCircle()"
  297. ]
  298. },
  299. {
  300. "cell_type": "code",
  301. "execution_count": 23,
  302. "metadata": {},
  303. "outputs": [],
  304. "source": [
  305. "# Create a new Rectangle class for creating a rectangle object\n",
  306. "\n",
  307. "class Rectangle(object):\n",
  308. " \n",
  309. " # Constructor\n",
  310. " def __init__(self, width=2, height=3, color='r'):\n",
  311. " self.height = height \n",
  312. " self.width = width\n",
  313. " self.color = color\n",
  314. " \n",
  315. " # Method\n",
  316. " def drawRectangle(self):\n",
  317. " plt.gca().add_patch(plt.Rectangle((0, 0), self.width, self.height ,fc=self.color))\n",
  318. " plt.axis('scaled')\n",
  319. " plt.show()"
  320. ]
  321. },
  322. {
  323. "cell_type": "code",
  324. "execution_count": 24,
  325. "metadata": {},
  326. "outputs": [],
  327. "source": [
  328. "# Create a new object rectangle\n",
  329. "\n",
  330. "SkinnyBlueRectangle = Rectangle(2, 10, 'blue')"
  331. ]
  332. },
  333. {
  334. "cell_type": "code",
  335. "execution_count": 25,
  336. "metadata": {},
  337. "outputs": [
  338. {
  339. "data": {
  340. "text/plain": [
  341. "10"
  342. ]
  343. },
  344. "execution_count": 25,
  345. "metadata": {},
  346. "output_type": "execute_result"
  347. }
  348. ],
  349. "source": [
  350. "# Print the object attribute height\n",
  351. "\n",
  352. "SkinnyBlueRectangle.height "
  353. ]
  354. },
  355. {
  356. "cell_type": "code",
  357. "execution_count": 26,
  358. "metadata": {},
  359. "outputs": [
  360. {
  361. "data": {
  362. "text/plain": [
  363. "2"
  364. ]
  365. },
  366. "execution_count": 26,
  367. "metadata": {},
  368. "output_type": "execute_result"
  369. }
  370. ],
  371. "source": [
  372. "# Print the object attribute width\n",
  373. "\n",
  374. "SkinnyBlueRectangle.width"
  375. ]
  376. },
  377. {
  378. "cell_type": "code",
  379. "execution_count": 27,
  380. "metadata": {},
  381. "outputs": [
  382. {
  383. "data": {
  384. "text/plain": [
  385. "'blue'"
  386. ]
  387. },
  388. "execution_count": 27,
  389. "metadata": {},
  390. "output_type": "execute_result"
  391. }
  392. ],
  393. "source": [
  394. "# Print the object attribute color\n",
  395. "\n",
  396. "SkinnyBlueRectangle.color"
  397. ]
  398. },
  399. {
  400. "cell_type": "code",
  401. "execution_count": 28,
  402. "metadata": {},
  403. "outputs": [
  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Ns449ES7lfAtZKulrSPyUcTPNDNWMPXslz/RUmfAn4M7AHuqqqTnU02cE0fS1BVDwIPdjTLqOSVgynhTAlnSjiTqsen8ZLWgaeB/cALvW14e87N9qaq2vIZe6/h/r9RaaWqlnrf8BzmnS13VVPCmXYq3LEd2u485pptR/7GvRzkrmpKOFOv4Yb85s62D7JVVb18MfnX05PANcA+4DfA4b62P8d8VwJHpqcvB/50ofn6vMUN+s2d7R5kq89wm725M8ijf13oIFvn9Blurjd3dtrFDrJ1Tp/hBv/mznYOstVnuEG/ubPtg2z1/Mh1lMmj1ZPAl3b6kXRmtncx+dPxW+DE9OvoVtfPSy5TXjmYEs6UcKaEMyWcKeFMCWf6HwezQ1Yzc3TpAAAAAElFTkSuQmCC\n",
  407. "text/plain": [
  408. "<Figure size 432x288 with 1 Axes>"
  409. ]
  410. },
  411. "metadata": {
  412. "needs_background": "light"
  413. },
  414. "output_type": "display_data"
  415. }
  416. ],
  417. "source": [
  418. "# Use the drawRectangle method to draw the shape\n",
  419. "\n",
  420. "SkinnyBlueRectangle.drawRectangle()"
  421. ]
  422. },
  423. {
  424. "cell_type": "code",
  425. "execution_count": 29,
  426. "metadata": {},
  427. "outputs": [],
  428. "source": [
  429. "# Create a new object rectangle\n",
  430. "\n",
  431. "FatYellowRectangle = Rectangle(20, 5, 'yellow')"
  432. ]
  433. },
  434. {
  435. "cell_type": "code",
  436. "execution_count": null,
  437. "metadata": {},
  438. "outputs": [],
  439. "source": [
  440. "# Print the object attribute height\n",
  441. "\n",
  442. "FatYellowRectangle.height "
  443. ]
  444. }
  445. ],
  446. "metadata": {
  447. "kernelspec": {
  448. "display_name": "Python",
  449. "language": "python",
  450. "name": "conda-env-python-py"
  451. },
  452. "language_info": {
  453. "codemirror_mode": {
  454. "name": "ipython",
  455. "version": 3
  456. },
  457. "file_extension": ".py",
  458. "mimetype": "text/x-python",
  459. "name": "python",
  460. "nbconvert_exporter": "python",
  461. "pygments_lexer": "ipython3",
  462. "version": "3.6.7"
  463. }
  464. },
  465. "nbformat": 4,
  466. "nbformat_minor": 4
  467. }
RAW Paste Data