Page 130 -
P. 130
functions
Well, duh, it‛s pretty obvious really...
you need a version of the function
that tweets the low price and
another that tweets an emergency
order. How hard is that?
def send_to_twitter():
# original code here...
T ake the original
Twitter code and
create two new
functions.
def send_to_twitter_price_low(): def send_to_twitter_emergency():
# original code here... # original code here...
# ...but change message to # ... but change message to
# buy at low price. # place an emergency order.
Lines that start with # are known
as comments in Python. Comments
are code annotations put there by a
coder and are meant to be read by
Python ignores all comments, because
Something doesn’t feel quite right about this solution. other coders working with the code.
Can you see the problem that this creates? Can you they aren't executable code.
think of a solution that fixes the problem?
you are here 4 95

