我想调用任一方法(getPerimeter | getArea)并根据提供的输入返回答案。
#!usr/bin/python
def getPerimeter(x, y):
answer = (2 * x) + (2 * y)
return string(answer) **This will not return anything in my terminal**
def getArea(x, y):
answer = x * y
return string(answer) **This also will not return anything in my terminal**
reply = raw_input("Do you want to find the area or the perimeter? ")
if reply == "area":
response1 = raw_input("What is the length ?: ")
response2 = raw_input("What is the width ?: ")
response1Int = int(response1)
response2Int = int(response2)
getArea(response1Int, response2Int)
else:
response3 = raw_input("What is the length ?: ")
response4 = raw_input("What is the width ?: ")
response3Int = int(response3)
response4Int = int(response4)
getPerimeter(response3Int, response4Int)