默认情况下,print()生成一个新行。而且您不需要在开始时使用。使用单个语句打印
占位符
使用。
占位符
-
数字
-%d个
-
一串
-%s个
在字符串的末尾放置所需的值。
语法
num1=10
num2=20
print("single number: %d"%num1)
print("two numbers: %d %d"%(num1,num2)) # note the brackets after %
# Output
single number: 10
two numbers: 10 20
解决你的问题
print("\nYou rerolled some dice and the new values are: %d %d %d %d %d"%(values[0],values[1],values[2],values[3],values[4]))