发布时间:2019-08-27 07:59:46编辑:auto阅读(2047)
在前面的尝试过程中没有什么甜头,多么无聊的输出预定义的内容,接下来说写点活的,真正感受一下程序的魅力:
在python中提供了raw_input
>>> name = raw_input("what is you name? ") what is you name? yuefan >>> print name yuefan
感觉有点意思啦,接下来玩个猜数字游戏遛遛:
# cat magic_num.py #/usr/bin/env python #coding: utf-8 a = 15 guess = 0 while a != guess: guess = input("猜数字,输入个数字试试: ") # print a,type(a), guess, type(guess) if guess < a: print "不对,小啦。\n" elif guess > a: print "不对,大啦。\n" print "不错啊,搞对啦!!!!"
这个可以让我的儿子玩玩啦,接下来把电脑时间交给儿子……
上一篇: python中Unicode和UTF-8
下一篇: python实例:公司应用(二)
50958
50341
40956
37825
32289
29179
28066
22896
22858
21191
1050°
1728°
1410°
1348°
1609°
1438°
2094°
3636°
3562°
2510°