How to print 2 items on the same line
本问题已经有最佳答案,请猛点这里访问。
我希望打印新余额的两行位于同一行,而不是两行。我该怎么做?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | def main(): # Initial balance balance = input ('Wallet balance: ') # Withdraw amount from wallet balance withdraw = input ('Withdraw amount: ') # Withdraw process and new balance display if withdraw > 0: new = balance - withdraw print ('Your new balance: ') print new main() |
单独的值用逗号: </P >
1 | print 'Your new balance:', new |
看了下面的一个示范: </P >
1 2 3 4 5 6 7 | >>> new = 123 >>> print 'Your new balance:', new Your new balance: 123 >>> >>> print 'a', 'b', 'c', 'd' a b c d >>> |
值得注意的是,做自动的场所空间之间的一个值。 </P >