循序渐进学Python2变量与输入
生活随笔
收集整理的這篇文章主要介紹了
循序渐进学Python2变量与输入
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
新建一個(gè)test.py文件,右鍵選擇“Edit with IDLE”,編輯完成后,Ctrl+S保存,然后按下F5就可以執(zhí)行代碼了。
注:IDLE是Python官方提供的一個(gè)IDE工具。
目錄?[隱藏]?
|
[編輯]注釋
#This is a commentprint"This will run."#comment[編輯]數(shù)字
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.轉(zhuǎn)載于:https://www.cnblogs.com/elesos/p/6738322.html
總結(jié)
以上是生活随笔為你收集整理的循序渐进学Python2变量与输入的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 规定自己的Java编码规范
- 下一篇: 【JeeSite】用户管理