Python printing problems -


print "i count slaves:"  print "females", 50 + 80 \ 10 print "males", 10 \ 2 print "is true 6 > 7?" print "what 59 + 27?" 

for reason, shows me:

    print "females", 50 + 80 \ 10                                 ^ syntaxerror: unexpected character after line continuation character 

the \ character line continuation character, not division operator. used tell python join lines together:

foo = "this long line won't fit inside 80 characters " \       "so line continuation character 1 way extend " \       "the logical line across multiple physical lines." 

use / division:

print "females", 50 + 80 / 10 print "males", 10 / 2 

Comments