设为首页收藏本站

Crossin的编程教室

 找回密码
 立即加入
查看: 30983|回复: 0
打印 上一主题 下一主题

【Python 第24课】 if的嵌套

[复制链接]

0

主题

1

好友

273

积分

中级会员

Rank: 3Rank: 3

楼主
发表于 2015-12-31 13:59:09 |显示全部楼层
def quadrant(x,y):
    if x>=0:
        if y>=0:
            return 1
        else:
            return 4
    else:
        if y>=0:
            return 2
        else:
            return 3
print 'please input your coordinates:'
x=input('the x is:')
y=input('the y is:')
answer=quadrant(x,y)
print 'the quadrant is %d.'%answer


get~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

QQ|手机版|Archiver|Crossin的编程教室 ( 苏ICP备15063769号  

GMT+8, 2024-5-5 12:36 , Processed in 0.031962 second(s), 22 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部