這品文章給大家介紹python 的數據類型和基礎的語法,非常簡單。
1、python的數據類型

python簡單的語法基礎
print(『hello,world』)print(『你好,北京』)
2、變量
name=」張曉文「print(name)
程序的交互
name=input"請輸入你的名字」print(name)「
3、數據類型
1、int,long類型
a=2*20print(a,type(a))
2、字符串類型str
name="input('請輸入你的名字')print(name,type(name))()
3、布爾類型
print(true,type)(true))
4、if語句
choice=input(『請輸入你猜的數字』)if choice==『2』 print(『我請你吃飯』)else print(『你請我吃飯』)
5、while語句
flag = true;count =1;while flag: print(count);
6、break語句
count=1while true: print(count) count=count+1 if count==101 break
7、continue語句
count=0 while count<10; count =count +1if count ==7;continue ;print(count )
8、in not in的語法
comment=input(『請輸入你的評論』) if 『傻子』 in comment: print (『您輸入的為敏感詞彙,請重新)
