The most common answer is:
can_juggle = True
The code below has problems. See if
you can fix them!
if can_juggle:
print “I can juggle!”
else:
print “I can’t juggle.”
To fix this code for compatibility with Python, especially Python 3, you need to use parentheses around the strings within the print
functions.
Here’s the corrected version:
can_juggle = True
if can_juggle:
print("I can juggle!")
else:
print("I can't juggle.")
This corrected code checks the boolean variable can_juggle
and prints "I can juggle!"
if True
, or "I can't juggle."
if False
.