Advertisement
ZEdKasat

Untitled

Mar 5th, 2022
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1.  
  2. # 16 Million colors
  3. colors = ["red", "green", "blue"]
  4.  
  5. ## Adding elements to the list
  6.  
  7. # print(colors)
  8. colors.append("white")
  9. # print(colors)
  10. colors.insert(1, "black")
  11. # print(colors)
  12.  
  13. # nums = [0, 1, 2, 3, 4, 5]
  14. # rev_nums = [5, 4, 3, 2, 1, 0]
  15. # for n in nums:
  16. # rev_nums.insert(0, n)
  17.  
  18. # print(rev_nums)
  19.  
  20.  
  21. ## Remove from list
  22.  
  23. # print(colors)
  24. # colors.remove("black")
  25. # print(colors)
  26. # popped_value = colors.pop(1)
  27. # print(colors)
  28. # print("popped value was", popped_value)
  29.  
  30.  
  31. ## update value of element in list
  32.  
  33. print(colors)
  34. colors[1] = "darkblue"
  35. print(colors)
  36.  
  37.  
  38. print("red" in colors)
  39.  
  40. print("aqua" not in colors)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement