1 Star 0 Fork 0

Gao Pengfei/learnPython

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ex8.py 753 Bytes
一键复制 编辑 原始数据 按行查看 历史
zhio 提交于 2017-02-09 18:25 . 输入输出的基本练习,
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-02-09 18:20:11
# @Author : Your Name (you@example.org)
# @Link : http://example.org
# @Version : $Id$
from sys import argv
script, user_name = argv
prompt = '> '#用户输入提示符
print "Hi %s, I'm the %s script." % (user_name, script)
print "I'd like to ask you a few questions."
print "Do you like me %s?" % user_name
likes = raw_input(prompt)
print "Where do you live %s?" % user_name
lives = raw_input(prompt)
print "What kind of computer do you have?"
computer = raw_input(prompt)
print """
Alright, so you said %r about liking me.
You live in %r. Not sure where that is.
And you have a %r computer. Nice.
""" % (likes, lives, computer)
#一个交互式游戏的雏形
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/gpfer/learnPython.git
git@gitee.com:gpfer/learnPython.git
gpfer
learnPython
learnPython
master

搜索帮助