Challenge 1
Capture the result of word_length("python") in length and compare that value with 5.
def word_length(word):
return len(word)
if :
print(length)
Press Ctrl⌘Enter to check your answer
Practice using := to capture values in conditions, loops, and expressions while keeping ordinary assignment separate.
Challenge 1
def word_length(word):
return len(word)
if :
print(length)
Press Ctrl⌘Enter to check your answer
Challenge 2
commands = iter(["start", "status", "quit"])
while :
print(command)
Press Ctrl⌘Enter to check your answer
Challenge 3
result =
print(result)
print(captured)
Press Ctrl⌘Enter to check your answer
Challenge 4
values = [3, 5, 8]
doubles = [double for value in values if ]
print(doubles)
Press Ctrl⌘Enter to check your answer