IPO Problems 2

Here’s a quick two problem IPO function “snack” to keep your skills sharp.

See IPO Problems 1 for an explanation of function and how these problems work.

1. Write a function named ticket_price that takes a person’s age as a parameter and returns the cost of a movie ticket.
Kids under 10 cost $7
Everyone else costs $12

def ticket_price(age):
# your code here
# return a value

# Do not change any code below
a = int(input('Enter the person\'s age:'))
result = ticket_price(a)
print('The ticket price is:', result)

2. Write a function named magic_item that takes a list of items as a parameter and returns one of them with the word "magic " in front of it. Use the random.choice function.

import random

def magic_item(items):
    # your code here
    # return a value

# Do not change any code below
stuff = ["sword", "shield", "potion", "ring"]
result = magic_item(stuff)
print('You pulled out:', result)