python的學習之路day1
阿新 • • 發佈:2017-11-12
enter break 一個 什麽 2.7 程序 字符串 學習之路 blog
軟件:python3、pycharm開發工具
python的開始:print("hello world") 註意:python3需要加上()
1、變量是什麽:在程序運行過程中它的值是允許改變的量被稱為變量
例如: a = 1
a = 2
b = a
a = 3
c = "smelond"
print(a, b, c)
輸出結果:3 2 smelond
註意:b = a b指向的為2,而不是a,字符串需要加上" "
2、input輸入函數
使用方法:name = input("Please input your name: ")
註意:在python2.7當中的輸入函數為:raw_input("Please input your name:")
3、int整形:
使用方法:int(input("Please enter your age: "))
4、if_elif_else(如果_否者如果_否者):
a_g_e = 16
age = int(input("Please enter your age: "))
if age = a_g_e:
``````
elif age > a_g_e:
``````
else:
``````
4、一個猜年齡的小遊戲:
用的到的語句:if_elif_else、for循環、continue、break
python的學習之路day1