Challenge 1
Unpack the tuple into the two positional arguments expected by distance().
def distance(x, y):
return (x * x + y * y) ** 0.5
point = (3, 4)
print(distance())
Press Ctrl⌘Enter to check your answer
Practice unpacking iterables and mappings into function calls with * and **.
Challenge 1
def distance(x, y):
return (x * x + y * y) ** 0.5
point = (3, 4)
print(distance())
Press Ctrl⌘Enter to check your answer
Challenge 2
def connect(host, port):
print(host, port)
settings = {"host": "example.com", "port": 443}
connect()
Press Ctrl⌘Enter to check your answer
Challenge 3
def report(title, count, active=False):
print(title, count, active)
values = ["items", 12]
options = {"active": True}
report()
Press Ctrl⌘Enter to check your answer
Challenge 4
def show(a, b, c, d):
print(a, b, c, d)
left = [1, 2]
right = [3, 4]
show()
Press Ctrl⌘Enter to check your answer