Guest User

Untitled

a guest
Feb 25th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": null,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "# your code goes here\n",
  10. "import random\n",
  11. "from time import time\n",
  12. "import numpy as np\n",
  13. "import matplotlib.pyplot as pplot\n",
  14. "\n",
  15. "\n",
  16. "def fibonacci(n):\n",
  17. " if n==0 :\n",
  18. " return 0\n",
  19. " a, b = 0, 1\n",
  20. " for i in range(1, n):\n",
  21. " a, b = b, a+b\n",
  22. " return b\n",
  23. "\n",
  24. "fibo = [0 for x in range(100)]\n",
  25. "\n",
  26. "for k in range(len(fibo)):\n",
  27. " fibo[k] = fibonacci(k)\n",
  28. "\n",
  29. "print(fibo)\n",
  30. "\n",
  31. "\n",
  32. "pplot.plot(fibo)\n",
  33. "\n",
  34. "pplot.show()"
  35. ]
  36. }
  37. ],
  38. "metadata": {
  39. "kernelspec": {
  40. "display_name": "Python 3",
  41. "language": "python",
  42. "name": "python3"
  43. },
  44. "language_info": {
  45. "codemirror_mode": {
  46. "name": "ipython",
  47. "version": 3
  48. },
  49. "file_extension": ".py",
  50. "mimetype": "text/x-python",
  51. "name": "python",
  52. "nbconvert_exporter": "python",
  53. "pygments_lexer": "ipython3",
  54. "version": "3.6.3"
  55. }
  56. },
  57. "nbformat": 4,
  58. "nbformat_minor": 2
  59. }
Add Comment
Please, Sign In to add comment