Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 16 Million colors
- colors = ["red", "green", "blue"]
- ## Adding elements to the list
- # print(colors)
- colors.append("white")
- # print(colors)
- colors.insert(1, "black")
- # print(colors)
- # nums = [0, 1, 2, 3, 4, 5]
- # rev_nums = [5, 4, 3, 2, 1, 0]
- # for n in nums:
- # rev_nums.insert(0, n)
- # print(rev_nums)
- ## Remove from list
- # print(colors)
- # colors.remove("black")
- # print(colors)
- # popped_value = colors.pop(1)
- # print(colors)
- # print("popped value was", popped_value)
- ## update value of element in list
- print(colors)
- colors[1] = "darkblue"
- print(colors)
- print("red" in colors)
- print("aqua" not in colors)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement