Python 每当编译和运行此代码时,控制台上打印的唯一内容是;这里有一些很酷的功能&引用;而我';我不知道为什么
如标题所述,仅打印第一行。我相信这是一个简单的解决办法,但我只是错过了一些东西 我几乎什么都试过了Python 每当编译和运行此代码时,控制台上打印的唯一内容是;这里有一些很酷的功能&引用;而我';我不知道为什么,python,function,Python,Function,如标题所述,仅打印第一行。我相信这是一个简单的解决办法,但我只是错过了一些东西 我几乎什么都试过了 print("Here are some cool functions!") def addition_function(a,b): return "The answer to %d plus %d is %d"%(a, b, a + b) def subtraction_function(a,b): return "The answer to %d minus %d is %
print("Here are some cool functions!")
def addition_function(a,b):
return "The answer to %d plus %d is %d"%(a, b, a + b)
def subtraction_function(a,b):
return "The answer to %d minus %d is %d"%(a, b, a - b)
def division_function(a,b):
return "The answer to %d divided by %d is %d"%(a, b, a / b)
def multiplication_function(a,b):
return "The answer to %d times %d is %d"%(a, b, a * b)
addition_function(5,5)
subtraction_function(10,5)
division_function(5,5)
multiplication_function(5,5)
因为这就是你打印的全部!您将只在控制台中看到它周围显式地有
print()
print("Here are some cool functions!")
def addition_function(a,b):
return "The answer to %d plus %d is %d"%(a, b, a + b)
def subtraction_function(a,b):
return "The answer to %d minus %d is %d"%(a, b, a - b)
def division_function(a,b):
return "The answer to %d divided by %d is %d"%(a, b, a / b)
def multiplication_function(a,b):
return "The answer to %d times %d is %d"%(a, b, a * b)
print(addition_function(5,5))
print(subtraction_function(10,5))
print(division_function(5,5))
print(multiplication_function(5,5))
试试那个代码 您返回字符串,但从不打印它们。执行
打印(添加功能(5,5))
等操作。