An introduction to python

04.variables.ipynb 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "markdown",
  5. "metadata": {},
  6. "source": [
  7. "# Variables"
  8. ]
  9. },
  10. {
  11. "cell_type": "markdown",
  12. "metadata": {},
  13. "source": [
  14. "Variables are used to store data that can change over time"
  15. ]
  16. },
  17. {
  18. "cell_type": "code",
  19. "execution_count": 9,
  20. "metadata": {},
  21. "outputs": [
  22. {
  23. "name": "stdout",
  24. "output_type": "stream",
  25. "text": [
  26. "1\n"
  27. ]
  28. }
  29. ],
  30. "source": [
  31. "i = 1 # create an interger \n",
  32. "print(i)"
  33. ]
  34. },
  35. {
  36. "cell_type": "code",
  37. "execution_count": 10,
  38. "metadata": {},
  39. "outputs": [
  40. {
  41. "name": "stdout",
  42. "output_type": "stream",
  43. "text": [
  44. "Hello\n"
  45. ]
  46. }
  47. ],
  48. "source": [
  49. "s = \"Hello\" # create a string\n",
  50. "print(s)"
  51. ]
  52. },
  53. {
  54. "cell_type": "code",
  55. "execution_count": 11,
  56. "metadata": {},
  57. "outputs": [
  58. {
  59. "name": "stdout",
  60. "output_type": "stream",
  61. "text": [
  62. "1.1\n"
  63. ]
  64. }
  65. ],
  66. "source": [
  67. "f = 1.1 \n",
  68. "print(f)"
  69. ]
  70. },
  71. {
  72. "cell_type": "markdown",
  73. "metadata": {},
  74. "source": [
  75. "<a href=\"http://localhost:8888/notebooks/03.Maths.ipynb\">Previous maths</a> \n",
  76. "<a style=\"float:right;margin-right:10em;\" href=\"http://localhost:8888/notebooks/05.input.ipynb\">Next input</a> "
  77. ]
  78. }
  79. ],
  80. "metadata": {
  81. "kernelspec": {
  82. "display_name": "Python 3",
  83. "language": "python",
  84. "name": "python3"
  85. },
  86. "language_info": {
  87. "codemirror_mode": {
  88. "name": "ipython",
  89. "version": 3
  90. },
  91. "file_extension": ".py",
  92. "mimetype": "text/x-python",
  93. "name": "python",
  94. "nbconvert_exporter": "python",
  95. "pygments_lexer": "ipython3",
  96. "version": "3.7.0"
  97. }
  98. },
  99. "nbformat": 4,
  100. "nbformat_minor": 2
  101. }