这品文章给大家介绍python 的数据类型和基础的语法,非常简单。

1、python的数据类型

python 语法总结 python的语法基础_python

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))()

python 语法总结 python的语法基础_python 语法总结_02

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 (‘您输入的为敏感词汇,请重新)

python 语法总结 python的语法基础_python_03

人生苦短我用python