Guest User

Untitled

a guest
Apr 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 1,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "nombre = \"Martín\""
  10. ]
  11. },
  12. {
  13. "cell_type": "code",
  14. "execution_count": 2,
  15. "metadata": {},
  16. "outputs": [
  17. {
  18. "data": {
  19. "text/plain": [
  20. "7.3213433073372585"
  21. ]
  22. },
  23. "execution_count": 2,
  24. "metadata": {},
  25. "output_type": "execute_result"
  26. }
  27. ],
  28. "source": [
  29. "10 * 2.3 / 3.1415"
  30. ]
  31. },
  32. {
  33. "cell_type": "code",
  34. "execution_count": 3,
  35. "metadata": {},
  36. "outputs": [],
  37. "source": [
  38. "mi_lista = [10, \"Lío Messi\", [\"lista\", \"interna\"]]"
  39. ]
  40. },
  41. {
  42. "cell_type": "code",
  43. "execution_count": 4,
  44. "metadata": {},
  45. "outputs": [
  46. {
  47. "data": {
  48. "text/plain": [
  49. "[10, 'Lío Messi']"
  50. ]
  51. },
  52. "execution_count": 4,
  53. "metadata": {},
  54. "output_type": "execute_result"
  55. }
  56. ],
  57. "source": [
  58. "mi_lista[0:2] "
  59. ]
  60. },
  61. {
  62. "cell_type": "code",
  63. "execution_count": 5,
  64. "metadata": {},
  65. "outputs": [
  66. {
  67. "data": {
  68. "text/plain": [
  69. "'HOLA'"
  70. ]
  71. },
  72. "execution_count": 5,
  73. "metadata": {},
  74. "output_type": "execute_result"
  75. }
  76. ],
  77. "source": [
  78. "cadena = \"HOLA MUNDO\"\n",
  79. "cadena[0:4]"
  80. ]
  81. },
  82. {
  83. "cell_type": "code",
  84. "execution_count": 6,
  85. "metadata": {},
  86. "outputs": [
  87. {
  88. "data": {
  89. "text/plain": [
  90. "'Messi'"
  91. ]
  92. },
  93. "execution_count": 6,
  94. "metadata": {},
  95. "output_type": "execute_result"
  96. }
  97. ],
  98. "source": [
  99. "jugador = {\"nombre\": \"Lionel\", \"apellido\": \"Messi\", \"edad\": 30}\n",
  100. "jugador['apellido']"
  101. ]
  102. },
  103. {
  104. "cell_type": "code",
  105. "execution_count": 7,
  106. "metadata": {},
  107. "outputs": [
  108. {
  109. "data": {
  110. "text/plain": [
  111. "6"
  112. ]
  113. },
  114. "execution_count": 7,
  115. "metadata": {},
  116. "output_type": "execute_result"
  117. }
  118. ],
  119. "source": [
  120. "sum([1, 2, 3])"
  121. ]
  122. },
  123. {
  124. "cell_type": "code",
  125. "execution_count": 8,
  126. "metadata": {},
  127. "outputs": [
  128. {
  129. "data": {
  130. "text/plain": [
  131. "3"
  132. ]
  133. },
  134. "execution_count": 8,
  135. "metadata": {},
  136. "output_type": "execute_result"
  137. }
  138. ],
  139. "source": [
  140. "len([1, 2, 3])"
  141. ]
  142. },
  143. {
  144. "cell_type": "code",
  145. "execution_count": 9,
  146. "metadata": {},
  147. "outputs": [
  148. {
  149. "data": {
  150. "text/plain": [
  151. "2.0"
  152. ]
  153. },
  154. "execution_count": 9,
  155. "metadata": {},
  156. "output_type": "execute_result"
  157. }
  158. ],
  159. "source": [
  160. "def promedio(lista_de_valores):\n",
  161. " sumatoria = sum(lista_de_valores)\n",
  162. " cantidad = len(lista_de_valores)\n",
  163. " return sumatoria / cantidad\n",
  164. "\n",
  165. "promedio([1, 2, 3])"
  166. ]
  167. },
  168. {
  169. "cell_type": "code",
  170. "execution_count": null,
  171. "metadata": {},
  172. "outputs": [],
  173. "source": []
  174. }
  175. ],
  176. "metadata": {
  177. "kernelspec": {
  178. "display_name": "Python 3",
  179. "language": "python",
  180. "name": "python3"
  181. },
  182. "language_info": {
  183. "codemirror_mode": {
  184. "name": "ipython",
  185. "version": 3
  186. },
  187. "file_extension": ".py",
  188. "mimetype": "text/x-python",
  189. "name": "python",
  190. "nbconvert_exporter": "python",
  191. "pygments_lexer": "ipython3",
  192. "version": "3.6.4"
  193. }
  194. },
  195. "nbformat": 4,
  196. "nbformat_minor": 2
  197. }
Add Comment
Please, Sign In to add comment