1. Use set() function to show only unique elements. And we can add() and remove() in a set. Also, it is allowed to use list() to change set into a list
2. User try/except to avoid errors in the program.
3.enumerate() function:
animals = ["Dog", "Tiger", "SuperLion", "Cow", "Panda"]
viciousness = [1, 5, 10, 10, 1]
for i, animal in enumerate(animals):#In the list animals, i is the index of each elements, animal in the element correspond to each element.
print("Animal")
print(animal)
print("Viciousness")
print(viciousness[i])
4.List comprehensions
5.The items() method:
plant_types = {"orchid": "flower", "cedar": "tree", "maple": "tree"}
for types,rating in plant_types.items():# here we use items() to avoid access both key and values on dictionaries.
print (types)
print (rating)