ASAP 3 HRS!! PYTHON ASSIGNMENT

profilepatel8903

8 Exercises

  1. Create a list of your favourite superheros and another list of their secret identities.
    1. Convert your two lists into a dictionary. (Can you do it in one line?)
    2. Remove one of your heroes and add a villain to your dictionary.
    3. Add a character that has multiple identities to your dictionary. (What kind of object should this be?)
    4. 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
  1. 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
  1. Flatten the following list using list comprehension.
mylist = [[[1, 2], [3, 4, 5]], [[6], [7, 8]]]

In [ ]:

# Add your solution here
  1. 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!

  • 2 years ago
  • 20
Answer(1)

Purchase the answer to view it

blurred-text
NOT RATED
  • attachment
    week01-assignment1.ipynb
  • attachment
    helpful_video.mp4