Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
98 lines (64 sloc) 1.99 KB

Lists

Starting with the following list...

planeteers = ["Earth", "Wind", "Captain Planet", "Fire", "Water"]

Access the second value in planeteers.

# Your answer here

Add "Heart" to the end of planeteers.

# Your answer here

Remove "Captain Planet" from the list.

# Your answer here

Combine planeteers with rangers = ["Red", "Blue", "Pink", "Yellow", "Black"] and save the result in a variable called heroes.

# Your answer here

Alphabetize the contents of heroes using a function.

# Your answer here

Randomize the contents of heroes using a function. The Python documentation might help.

# Your answer here

Bonus

Select a random element from heroes using a function. The Python documentation might help.

# Your answer here

Dictionaries

Initialize a dictionary called ninja_turtle with the properties name, weapon and radical. They should have values of "Michelangelo", "Nunchuks" and true respectively.

# Your answer here

Add a key age to ninja_turtle. Set it to whatever numerical value you'd like.

# Your answer here

Remove the radical key-value pair from ninja_turtle.

# Your answer here

Add a key pizza_toppings to ninja_turtle. Set it to an list of strings (e.g., ["cheese", "pepperoni", "peppers"]).

# Your answer here

Access the first element of pizza_toppings.

# Your answer here

Produce an list containing all of ninja_turtle's keys using a function. The Python documentation might help.

# Your answer here

Bonus

Print out each key-value pair in the following format - "KEY's is equal to VALUE" -- using a function. The Python documentation might help.

# Your answer here