Create a list of your favourite superheros and another list of their secret identities
8 Exercises
- Create a list of your favourite superheros and another list of their secret identities.
- Convert your two lists into a dictionary. (Can you do it in one line?)
- Remove one of your heroes and add a villain to your dictionary.
- Add a character that has multiple identities to your dictionary. (What kind of object should this be?)
- Demonstrate that you can look up one of your character’s identities.
SuperheroIdentityIron ManTony StarkThe ThingBen GrimmStormOroro MunroeSpider-ManPeter Parker, Miles MoralesIn [61]:
# Add your solution here
- Use Hubble’s law (????=????0????v=H0D) to calculate the distance (in Mpc) of the galaxies in the following table.
GalaxyVelocity (km/s)NGC 1231320NGC 23425690NGC 44428200
Remember that ????0≈70H0≈70 km/s/Mpc.
In [ ]:
# Add your solution here
- Flatten the following list using list comprehension.
mylist = [[[1, 2], [3, 4, 5]], [[6], [7, 8]]]
In [ ]:
# Add your solution here
- Write a generator function that can be used to calculate the Fibonacci sequence.
In [ ]:
# Add your solution here
LAST 4 QUESTIONS ON THE ATTACHED FILE!
-
week01-assignment.ipynb