# File: twoplustwo.py # show the difference between strings and numbers when printing # # Matt Bishop, ECS 10, Spring 2014 # # # basic printing # # first, the simple way print("2 + 2 =", 2 + 2) # now, with a string print("2 + 2 =", '2 + 2') # now comes handling the end of the line print('==========================') # # now, see what happens with 2 print statements print("2 + 2 =") print(2 + 2) print('--------------------------') # # and we'll put the output on the same line print("2 + 2 =", 2 + 2, end='5') print(2 + 2) print('--------------------------') # # finally, another example of using "end" print("2 + 2 = ", end='>>>') print(2 + 2, end="<<<") print('\n--------------------------') # # just don't go to the next line print("hello ", end="") print("world") print("\\n") print("--------")