
names=["Fred", "Jim", "Sheila"]
print(names)
print(type(names))
print(names[0])
names[1] = "Jimmy"
print(names)

nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

print("nums minus two", nums[-2])

print(nums[3:7])
print(nums[3:7:2])
nums[3] = [9, 9, 9]  #  inserts List 999 as ONE ITEM
nums[3:4] = [9, 9, 9]  #  merges list as three new items
print(nums)

print(nums[::-1])

print("list contains 5?", 5 in nums)
print("list contains 99?", 99 in nums)

tup = (0, 1, 2)
print(tup)
print(tup[0])
print(type(tup))

# tup[0] = 99  #  tuples themselves are immutable (but if they contain mutable objects...)

names = {"Fred" : "Jones", "Jim" : " Smith"}
print(names)
print(names["Fred"])
print(type(names))
names["Sheila"] = "Williams"
print(names)

# print(names["Bad"])  #  raises a KeyError

print("Fred" in names)
print("Bad" in names)

print(names.items())
print(type(list(names.items())[0]))
