python 01 print input int

來源:互聯網
上載者:User

標籤:nbsp   變數   int   語言   目標   NPU   int()   inpu   執行   

 學過c語言與c語言的資料結構與演算法後再來學習python,感覺編程的核心內容沒有變,但每個程式設計語言都有自己的特點。本次學習的目標是理解python的特點與用法,把學過的bif(內建函數)用法記錄下來,最後實現一些python的實際用法。教程視頻:小甲魚python,python版本3.7

 command+N 編寫頁面  run(F5) 執行

‘ 與" 的區別

表示字串,沒什麼區別。‘Hello‘和"Hello"對Python是一樣的。但是用""這個時,裡面可以用‘,比如"Let‘s go" 

1.print()

>>> ni=3
>>> fa=2
>>> print(fa)
2
>>> print(fa+ni)
5
>>> ni=‘q‘
>>> fa=‘w‘
>>> print(ni+fa)
qw

>>> print(‘ni+fa‘)
ni+fa

 

變數直接放在print中,文字變數放在一起可用+號串連

 

 

 

2.input ()   顯示並輸入 可 a=input() 

3. if的格式

if   條件:                      條件 + :   

(tab)執行語句

(tab)執行語句            前置tab為if條件下執行

 

.....

else:

(tab) 執行語句

.......

 

 

1 print(‘hi‘)2 temp= input (" number?")3 guess=int(temp)4 if guess==8:5     print("yes")6 else:7     print("on")8 print("88")9     

 

python 01 print input int

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.