Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 13 Online
OpenStudy (anonymous):

Is one way preferential over another? x = 5 print "ABC", x x = 5 print "ABC" + str(x)

OpenStudy (anonymous):

i think code that u have mentioned is perl style syntax but code u mentioned will aborted because of compilation syntax error

OpenStudy (anonymous):

It depends on your purpose. x = 5 print "ABC", x adds a space in between 'ABC' and 5. This will print out 'ABC 5' On the other hand, x = 5 print "ABC" + str(x) will print out 'ABC5' Another way to print 'ABC 5' is by: x = 5 print 'ABC %d' %x %d serves as a place holder for an integer. You have to put in %variable after the string.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!