Python 试图找出如何传递函数,以便它可以显示值 #要运行的Main def main(): 键盘输入=int(输入('输入土地价格:$)#抓取用户输入 计算(键盘输入)#用于计算w/kbInput参数的函数 显示(assessmentValue,realTax)#显示值
只需在外部将Python 试图找出如何传递函数,以便它可以显示值 #要运行的Main def main(): 键盘输入=int(输入('输入土地价格:$)#抓取用户输入 计算(键盘输入)#用于计算w/kbInput参数的函数 显示(assessmentValue,realTax)#显示值,python,Python,只需在外部将calculate()调用中的值分配给变量即可 # Main to run def main(): keyboardInput = int(input('Enter the price of the land: $')) # grab user input calculate(keyboardInput) # function to calculate w/ kbInput parameter display(assessmentValue, realTax
calculate()
调用中的值分配给变量即可
# Main to run
def main():
keyboardInput = int(input('Enter the price of the land: $')) # grab user input
calculate(keyboardInput) # function to calculate w/ kbInput parameter
display(assessmentValue, realTax) # display the values <- this one right here
# Calculate the assessment value and property tax. Display afterwards
def calculate(keyboardInput):
assesssmentValue = keyboardInput * 0.60 # 60% for property actual value
realTax = (assesssmentValue * .64) / 100 # calculate the tax
return assesssmentValue, realTax
# Display the prices
def display(assesssmentValue, realTax):
print('The assessment value is : $', format(assesssmentValue, '.2f'))
print('The property tax is: $', format(realTax, '.2f'))
# ^ display the values
# Call the main to run
main()
只需在外部将
calculate()
调用中的值分配给变量即可
# Main to run
def main():
keyboardInput = int(input('Enter the price of the land: $')) # grab user input
calculate(keyboardInput) # function to calculate w/ kbInput parameter
display(assessmentValue, realTax) # display the values <- this one right here
# Calculate the assessment value and property tax. Display afterwards
def calculate(keyboardInput):
assesssmentValue = keyboardInput * 0.60 # 60% for property actual value
realTax = (assesssmentValue * .64) / 100 # calculate the tax
return assesssmentValue, realTax
# Display the prices
def display(assesssmentValue, realTax):
print('The assessment value is : $', format(assesssmentValue, '.2f'))
print('The property tax is: $', format(realTax, '.2f'))
# ^ display the values
# Call the main to run
main()