Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "# your code goes here\n",
- "import random\n",
- "from time import time\n",
- "import numpy as np\n",
- "import matplotlib.pyplot as pplot\n",
- "\n",
- "\n",
- "def fibonacci(n):\n",
- " if n==0 :\n",
- " return 0\n",
- " a, b = 0, 1\n",
- " for i in range(1, n):\n",
- " a, b = b, a+b\n",
- " return b\n",
- "\n",
- "fibo = [0 for x in range(100)]\n",
- "\n",
- "for k in range(len(fibo)):\n",
- " fibo[k] = fibonacci(k)\n",
- "\n",
- "print(fibo)\n",
- "\n",
- "\n",
- "pplot.plot(fibo)\n",
- "\n",
- "pplot.show()"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.6.3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
Add Comment
Please, Sign In to add comment