【Python初学者】准备
生活随笔
收集整理的這篇文章主要介紹了
【Python初学者】准备
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
準備著手學習Python這門久仰大名的語言。本篇隨筆是學習它的準備階段。
操作系統:
Mac OS 10.11.5
下載編輯器Testwrangler
點我
第一個Python程序
在命令行中運行python:
在命令行中新建文件夾ChenPython,并且在其中新建文件 MyFirstPythonProgram
換名字,改成.py格式;然后編輯它,在終端運行:python MyFirstPythonProgram.py
井號的作用
在python中,#是注釋的意思。
#Python examples 2016/9/19 by wasdns print "HelloWorld!" #End of file#的英文名是pound character。
簡單計算
#Python Examples 2016/9/19 by Wasdns print "Calculator:" 30 + 25 / 5 print "Calculator:" 30 % 5 #End of file哈哈,首錯:
更改:
#Python Examples 2016/9/19 by Wasdns print "Calculator:", 30 + 25 / 5 print "Calculator:", 30 % 5 #End of file輸出結果:
增加大小比較:
#Python Examples 2016/9/19 by Wasdns print "Calculator:", 30 + 25 / 5 print "Calculator:", 30 % 5print "Pause..."print "It's it true? 3 + 3 < 9", 3 + 3 < 9 print "Did the Terminal print true?" #End of file輸出:
變量
#Python Examples 2016/9/19 by Wasdns print "Calculator:", 30 + 25 / 5 print "Calculator:", 30 % 5print "Pause..."print "It's it true? 3 + 3 < 9", 3 + 3 < 9 print "Did the Terminal print true?"print "Add a variable..."Iamboy = 1 Sheisgirl = 1 Iamgirl = 0 Sheisboy = 0print "Iamboy = ", Iamboy, " Sheisgirl = ", Sheisgirl, " Iamgirl = ", Iamgirl, " Sheisboy = ", Sheisboyprint "Add Finished..."#End of file輸出:
2016/9/19
總結
以上是生活随笔為你收集整理的【Python初学者】准备的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C# WinForm中 让控件全屏显示的
- 下一篇: 事务BEGIN TRANSACTION