[英]Variable printing with Integer values in Python
Could anybody help with this python problem? 有人可以帮助解决这个python问题吗?
Problem: -I need to print multiple variables times together when the variables have integer values. 问题:-当变量具有整数值时,我需要一起打印多个变量。
If it helps i am trying to make a volume calculator and this is for context: 如果有帮助,我正在尝试制作一个体积计算器,这是针对上下文的:
if(custom_answer is True and preset_answer is False):
custom_length_answer=input("Length=")
custom_width_answer=input("Width=")
custom_height_answer=input("Height=")
a=custom_length_answer
b=custom_width_answer
c=custom_height_answer
while custom_answer is True and preset_answer is False:
print("The volume of your custom measurements is..."int(a*b)*c)
Alright! 好的! So I am assuming that:
所以我假设:
This is what your code should look like: 这是您的代码应如下所示:
if (custom_answer == True and preset_answer == False):
custom_length_answer = a = int(raw_input("Length= ") # assign variable to a and assuring that it is already an integer using the int.
custom_length_answer = b = int(raw_input("Width= ") # Same as above
custom_length_answer = c = int(raw_input("Height= ") # Same as above
return a # returning the value of the variables
return b
return c
while custom_answer == True and preset_answer == False: # Your loop
print("The volume of your custom measurements is:" + a*b*c)
# some more code
Hopefully this helps! 希望这会有所帮助! :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.