print("Hello Python") #输出
'''多行注释 用 三个引号
'''
a=1 #赋值 变量首字母只能书字母下划线 第二个字符数字,字母,下划线
声明一个列表 [ ]
abc=["My","You"]abc[0]# 'My'abc[1] = "He" #替换列表中的元素
定义一个元祖 ()
cde = ("My","You")cde[0]
列表中的元素可以修改 元祖不能修改
集合 set 集合中的元素不能重复,两个集合的交集
a="sajdlkjasj"b="ajsklaanmslkd"sa = set(a) #集合sb = set(b)sa&sb #取两个字符串交集sa|sb #取并集
字典 {key:value,key2:value2}
d1={"name":"zy","sex":"man"}d1["name"] #zyd1["sex"] #man
if
a=1if(a>7): # if a>7 if+空格+条件print("a>7")elif(a<2):print("a<2")else:print("nnn")
while
a=0while a<8:print("hello")a+=1
for
a=["a","c","d"]for i in a:print(i)for i in range(0,10): #输出0,1,2,3,4,5,6,7,8,9 一共10个数print(i)
break中止当前循环语句 continue中止一次