Python中一般使用coordinate函数定义坐标,使用方法如下:
def coordinate(x, y):
return {
(True, True ) : 1,
(True, False) : 2,
(False, True ) : 3,
(False, False) : 4
}[(x > 0, y > 0)]
if __name__ == "__main__":
print 'Please insert X,Y'
x = input('Please insert X')
y = input('Please insert Y')
print coordinate(float(x), float(y))
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:python中什么是函数