Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1.  
  2. # This is a months tuple that contains the last months of the year
  3. months = ("September", "October", "November", "December")
  4.  
  5. # This is a code to convert a list of strings to a tuple and assign it to a
  6. # variable
  7.  
  8. # A variable assigned to a list of strings
  9. favs = ["The Gentleman", "Rough Night", "Ender's Game"]
  10. # This converts the list to a tuple
  11. print(tuple(["The Gentleman", "Rough Night", "Ender's Game"]))
  12. # Assigning the tuple to a variable
  13. movies = ("The Gentleman", "Rough Night", "Ender's Game")
  14.  
  15. # This is a numbers tuple assigned to another tuple containing the various
  16. # numbers tuple
  17.  
  18. # The various numbers tuple
  19. numbers_a = (1, 2, 3)
  20. numbers_b = (4, 5, 6)
  21. numbers_c = (7, 8, 9)
  22. # The tuple containing the various tuples
  23. all_numbers = (numbers_a, numbers_b, numbers_c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement