guess_python

准备接下来的21天内每天抽出2小时的时间学习下胶水语言Python。

短暂的时间我也不强求深刻领悟些什么。只希望在不耽误读书的同时能让Python提高我的效率。

不大喜欢hello world,一个简单趣味猜数游戏让自己稍微感受下Python的语法:


true_num = int(raw_input("\nInput the true number: "))

guess_num = int(raw_input("\nInput the guess number: "))

if guess_num > true_num:
	print("sorry,it's lower than that...\n")
elif guess_num < true_num:
	print("sorry,it's higher than that...\n")
else:
	print("amazing! u win!")

print("game over")

附:代码引用改编于Python 流程控制 - 实验楼

已有4条评论

  1. 最小说 2024-01-13 20:25 回复
    我学了一年多也没学会
  2. 货架 2017-01-24 23:13 回复
    学习了,祝新年进步!
  3. <h1>哈哈<h1> 2016-11-22 15:26 回复
    哈哈,最简单的两个数比较
  4. whzecomjm 2016-07-26 15:04 回复
    python是个好东西

添加新评论

| 4个评论