python - How to print 2 items on the same line -
this question has answer here:
- how print without newline or space? 26 answers
i prefer 2 lines print new balance on same line instead of 2 separate lines. how do this?
def main(): # initial balance balance = input ('wallet balance: ') # withdraw amount wallet balance withdraw = input ('withdraw amount: ') # withdraw process , new balance display if withdraw > 0: new = balance - withdraw print ('your new balance: ') print new main()
separate values comma:
print 'your new balance:', new see demonstration below:
>>> new = 123 >>> print 'your new balance:', new new balance: 123 >>> >>> print 'a', 'b', 'c', 'd' b c d >>> note doing automatically places space between values.
Comments
Post a Comment