当前位置:
首页 >
循序渐进学Python2变量与输入
发布时间:2023/12/20
57
豆豆
生活随笔
收集整理的这篇文章主要介绍了
循序渐进学Python2变量与输入
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
新建一个test.py文件,右键选择“Edit with IDLE”,编辑完成后,Ctrl+S保存,然后按下F5就可以执行代码了。
注:IDLE是Python官方提供的一个IDE工具。
目录[隐藏]
|
[编辑]注释
#This is a commentprint"This will run."#comment[编辑]数字
print 25 + 30 / 6print"Is it true that 3+2 < 5-7?"print 3+2<5-7输出:
30 Is it true that 3+2<5-7? False[编辑]变量
cars =100print"There are", cars,"cars available."输出:
There are 100 cars available. my_name ="Lei Jun" your_name ="Jobs"print"Let's talk about", my_name print"Let's talk about %s and %s." % (my_name, your_name)输出:
Let's talk about Lei Jun Let's talk about Lei Jun and Jobs.[编辑]输入用法
print"How old are you?" age =raw_input()print"You're %s old."% age输出:
How old are you? 27 You're 27 old.或
age =raw_input("How old are you?")print"You're %s old."% age输出:
How old are you?38 You're 38 old.转载于:https://www.cnblogs.com/elesos/p/6738322.html
总结
以上是生活随笔为你收集整理的循序渐进学Python2变量与输入的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 规定自己的Java编码规范
- 下一篇: zhlan--Python中常见的几种格