Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 2,
  6. "metadata": {},
  7. "outputs": [
  8. {
  9. "data": {
  10. "text/plain": [
  11. "8"
  12. ]
  13. },
  14. "execution_count": 2,
  15. "metadata": {},
  16. "output_type": "execute_result"
  17. }
  18. ],
  19. "source": [
  20. "genres_tuple = (\"pop\",\"rock\",\"soul\",\"hard rock\",\"soft rock\",\\\n",
  21. " \"R&B\",\"progressive rock\",\"disco\")\n",
  22. "len(genres_tuple)"
  23. ]
  24. },
  25. {
  26. "cell_type": "code",
  27. "execution_count": 3,
  28. "metadata": {},
  29. "outputs": [
  30. {
  31. "data": {
  32. "text/plain": [
  33. "'hard rock'"
  34. ]
  35. },
  36. "execution_count": 3,
  37. "metadata": {},
  38. "output_type": "execute_result"
  39. }
  40. ],
  41. "source": [
  42. "genres_tuple[3]"
  43. ]
  44. },
  45. {
  46. "cell_type": "code",
  47. "execution_count": 4,
  48. "metadata": {},
  49. "outputs": [
  50. {
  51. "data": {
  52. "text/plain": [
  53. "('hard rock', 'soft rock', 'R&B')"
  54. ]
  55. },
  56. "execution_count": 4,
  57. "metadata": {},
  58. "output_type": "execute_result"
  59. }
  60. ],
  61. "source": [
  62. "genres_tuple[3:6]"
  63. ]
  64. },
  65. {
  66. "cell_type": "code",
  67. "execution_count": 5,
  68. "metadata": {},
  69. "outputs": [
  70. {
  71. "data": {
  72. "text/plain": [
  73. "('pop', 'rock')"
  74. ]
  75. },
  76. "execution_count": 5,
  77. "metadata": {},
  78. "output_type": "execute_result"
  79. }
  80. ],
  81. "source": [
  82. "genres_tuple[0:2]"
  83. ]
  84. },
  85. {
  86. "cell_type": "code",
  87. "execution_count": 6,
  88. "metadata": {},
  89. "outputs": [
  90. {
  91. "data": {
  92. "text/plain": [
  93. "7"
  94. ]
  95. },
  96. "execution_count": 6,
  97. "metadata": {},
  98. "output_type": "execute_result"
  99. }
  100. ],
  101. "source": [
  102. "genres_tuple.index(\"disco\")"
  103. ]
  104. },
  105. {
  106. "cell_type": "code",
  107. "execution_count": 7,
  108. "metadata": {},
  109. "outputs": [
  110. {
  111. "data": {
  112. "text/plain": [
  113. "[-5, -3, 1]"
  114. ]
  115. },
  116. "execution_count": 7,
  117. "metadata": {},
  118. "output_type": "execute_result"
  119. }
  120. ],
  121. "source": [
  122. "C_tuple = (-5, 1, -3)\n",
  123. "C_list = sorted(C_tuple)\n",
  124. "C_list"
  125. ]
  126. },
  127. {
  128. "cell_type": "code",
  129. "execution_count": null,
  130. "metadata": {},
  131. "outputs": [],
  132. "source": []
  133. }
  134. ],
  135. "metadata": {
  136. "kernelspec": {
  137. "display_name": "Python 3",
  138. "language": "python",
  139. "name": "python3"
  140. },
  141. "language_info": {
  142. "codemirror_mode": {
  143. "name": "ipython",
  144. "version": 3
  145. },
  146. "file_extension": ".py",
  147. "mimetype": "text/x-python",
  148. "name": "python",
  149. "nbconvert_exporter": "python",
  150. "pygments_lexer": "ipython3",
  151. "version": "3.6.8"
  152. }
  153. },
  154. "nbformat": 4,
  155. "nbformat_minor": 2
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement