python - How to print 2 items on the same line -


this question has answer here:

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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -