2015-01-16 2 views
0

누구나이 파이썬 문제를 도와 줄 수 있습니까?파이썬에서 정수 값을 사용하는 변수 인쇄

문제 : - 변수에 정수 값이있는 경우 여러 변수 시간을 함께 인쇄해야합니다.

는 내가 볼륨 계산기를 만들려고 노력하고 도움이 문맥의 경우 : 좋아

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) 
+0

"변수에 정수 값이있는 경우 여러 변수 시간을 함께 인쇄해야합니다." 나는 그 문장을 이해할 수 없다. – jgritty

+0

저는 세 가지 변수 (길이, 너비 및 높이)를 취하고 있으며 프리즘의 체적을 계산하려고합니다. 그게 맞습니까? 출력을 위해 이상적으로 당신이 원하는 것을 말할 수 있습니까? 또한, 결국, 귀하의 루프는 무엇에 사용됩니까? – Zizouz212

+0

정수 값을 가지고있을 때 변수를 출력 할 수 있어야합니다. 대신 변수를 출력하는 대신 변수가 보유하고있는 숫자를 표시하는 대신 변수를 합계로 사용하여 결과를 얻을 수 있기를 원합니다. . – Zinc

답변

0

! 그래서 난 그 가정 오전 :

  1. 당신은 정수
  2. 당신은 while 루프 당신은 사용자가 입력했다는 변수를 반환 할
  3. 에 볼륨을 계산해야
  4. 할 변수가 필요합니다.

    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 
    

    는 희망이 도움이 :

  5. 나는 또한 당신이 파이썬 2

이 코드를 같이한다 무엇을 사용하고 있으리라 믿고있어! :)