← Back to challenges

Building Profiles

PythonHardloopslogicstrings

Instructions

Create a function that takes multiple arguments, including the first and last name of a person. It should return a dictionary containing all the information which was given in an orderly manner.

Examples

build_profile("Isaac", "Newton",  location="Kensington", field=["physics", "math", "astronomy", "theology"] ) ➞ { "first_name": "Isaac", "last_name": "Newton", "location": "Kensington", "field": ["physics", "math", "astronomy", "theology"] }

build_profile("Marie", "Curie",  location="Sancellemoz", field="chemistry", discovered="Radium, Polonium" ) ➞ { "first_name": "Marie", "last_name": "Curie", "location": "Sancellemoz", "field": "chemistry", "discovered": "Radium, Polonium" }

build_profile("Donald", "Trump",  party="republican", current_profession="president", president = "45th" ) ➞ { "first_name": "Donald", "last_name": "Trump", "party": "republican", "current_profession": "president", "president": "45th" }

Notes

  • The arguments must include the first and last name.
  • Other arguments may or may not be given.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.