SHARE
TWEET

Untitled

a guest Jul 19th, 2019 60 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": 1,
  6.    "metadata": {},
  7.    "outputs": [],
  8.    "source": [
  9.     "import matplotlib.pyplot as plt\n",
  10.     "%matplotlib inline"
  11.    ]
  12.   },
  13.   {
  14.    "cell_type": "code",
  15.    "execution_count": 2,
  16.    "metadata": {},
  17.    "outputs": [],
  18.    "source": [
  19.     "class circle(object):\n",
  20.     "    def _init_(self, colour, radius):\n",
  21.     "        self.colour=colour\n",
  22.     "        self.radius=radius\n",
  23.     "    \n",
  24.     "    def add_radius(self, r):\n",
  25.     "        self.radius=self.radius + r\n",
  26.     "        return(self.radius)\n",
  27.     "    \n"
  28.    ]
  29.   },
  30.   {
  31.    "cell_type": "code",
  32.    "execution_count": 2,
  33.    "metadata": {},
  34.    "outputs": [],
  35.    "source": [
  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": 3,
  45.    "metadata": {},
  46.    "outputs": [
  47.     {
  48.      "ename": "NameError",
  49.      "evalue": "name 'circle' is not defined",
  50.      "output_type": "error",
  51.      "traceback": [
  52.       "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  53.       "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
  54.       "\u001b[0;32m<ipython-input-3-3e3602b2c326>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mredcircle\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcircle\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'red'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
  55.       "\u001b[0;31mNameError\u001b[0m: name 'circle' is not defined"
  56.      ]
  57.     }
  58.    ],
  59.    "source": [
  60.     "redcircle=circle(10, 'red')"
  61.    ]
  62.   },
  63.   {
  64.    "cell_type": "code",
  65.    "execution_count": null,
  66.    "metadata": {},
  67.    "outputs": [],
  68.    "source": []
  69.   }
  70.  ],
  71.  "metadata": {
  72.   "kernelspec": {
  73.    "display_name": "Python 3",
  74.    "language": "python",
  75.    "name": "python3"
  76.   },
  77.   "language_info": {
  78.    "codemirror_mode": {
  79.     "name": "ipython",
  80.     "version": 3
  81.    },
  82.    "file_extension": ".py",
  83.    "mimetype": "text/x-python",
  84.    "name": "python",
  85.    "nbconvert_exporter": "python",
  86.    "pygments_lexer": "ipython3",
  87.    "version": "3.6.7"
  88.   }
  89.  },
  90.  "nbformat": 4,
  91.  "nbformat_minor": 4
  92. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top