import time
import random
print "Wanna play a game?"
raw_input(),\
time.sleep(1)
print ("Think of a number (1-5), I won't see, I promise. \n"),\
time.sleep(5)
print "You picked? Now write it down."
raw_input(),\
time.sleep(3)
print ("Let me guess... \n"),\
time.sleep(2)
print ((random.randint(1, 5))), \
time.sleep(20000)
在终端中运行时,会发生以下情况:
Wanna play a game?
yes
Think of a number (1-5), I won't see, I promise.
None
You picked? Now write it down.
Let me guess...
None
1
为什么会弹出“无”
代码中的
,\
向print语句添加新参数并打印它,在本例中,它是time.sleep()
(None
)的返回值去掉这些,固定压痕,它就工作了
输出:
相关问题 更多 >
编程相关推荐