python猜数字程序
来源:互联网 发布:借钱软件 编辑:程序博客网 时间:2024/06/08 02:21
用Python写的猜数字程序
#this is a guess the number game.import randomsecretNumber = random.randint(1,20)print('I am thinking of a number between 1 and 20.')#ask the player to guess the number 6 times.for i in range(1,7):print('Take a guess.')guess = int(input())if guess < secretNumber:print('Your guess is too low.')elif guess > secretNumber:print('Your guess is too high.')else:breakif guess == secretNumber:print('Good ! '+str(i) + ' guesses!')else:print('Nope.'+str(secretNumber))
I am thinking of a number between 1 and 20.Take a guess.4Your guess is too low.Take a guess.16Your guess is too high.Take a guess.134Your guess is too high.Take a guess.9Good ! 4 guesses!
阅读全文
0 0
- python猜数字程序
- Python小程序——猜数字
- Python入门编程小程序-猜数字游戏
- 罗马到数字的转换程序 python
- 猜数字的程序
- 猜数字程序
- py程序-->猜数字
- 猜数字游戏程序
- python猜数字游戏
- python猜数字源代码
- Python 猜数字
- Python 猜数字 小游戏
- python-猜数字游戏
- Python猜数字游戏
- python 猜数字游戏
- Python猜数字
- python猜数字小游戏
- python猜数字游戏
- 是的,今天我离职了!
- 高效率的网站打开速度优化方法
- python数据结构与算法
- 《浪潮之巅》吴军
- html 移动端价格日历
- python猜数字程序
- JavaWeb之tomcat安装、配置与使用(一)
- 第3章 Opencv图像处理进阶-【第一部分 图像处理C】(imgproc组件、feature2D组件)
- linux下导入、导出mysql数据库命令
- ERROR 1396 (HY000): Operation CREATE USER failed for 'Raikon'@'localhost' 处理
- 周志华《Machine Learning》学习笔记(14)--计算学习理论
- Struts核心业务之请求数据的自动封装
- MAMP 数据库文件的位置
- 解决微信授权回调页面域名只能设置一个的问题 [php]