怎么利用python输出星座


当前第2页 返回上一页

相关推荐:《Python视频教程》

1

2

3

4

5

6

7

8

def get_constellation(month, date):

    dates = (21, 20, 21, 21, 22, 22, 23, 24, 24, 24, 23, 22)

    constellations = ("摩羯", "水瓶", "双鱼", "白羊", "金牛", "双子", "巨蟹", "狮子", "处女", "天秤", "天蝎", "射手", "摩羯")

    if date < dates[month-1]:

    return constellations[month-1]

    else:

    return constellations[month]

print (get_constellation(7, 10) )

结果如下:

1

 

以上就是怎么利用python输出星座的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

如何用爬虫破解滑动验证码

Python全栈工程师是什么意思

window下编写Python脚本在linux下运行出错 usr/bin/Python^m: bad interpreter: no such file or directory

Python如何切换线程

Python list和tuple的区别

Python 33个保留字是什么意思

Python字典可以排序吗

四六级成绩还可以这样查?Python助你装b一步到位!!!

Python库怎么安装

Python 里如何手工进行延迟

更多相关阅读请进入《Python》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...