# t TAB键 n 换行 转义字符
print('I'm going to the movies')
print("This is a string enclosed by "" not '' ")
firstVariable='Hello World'
print(firstVariable)
# 改变大小写输出
print(firstVariable.lower())
print(firstVariable.upper())
print(firstVariable.title())
# help(firstVariable.lower)
# 分割字符串 以空格分割
firstVariable.split(' ')
print('0'+'1') #相连
print('0'*3) #重复
# 求幂 求余
print(2**3)
print(9%3)
#逻辑运算符: and or not
#判断 if elif else
# 列表 [] z=[3,7,4,2],z[-2]表示倒数第二个元素
# 列表切片z[0:2]前开后闭,[3,7]# 取最大最小长度总和:print(min(z),max(z),len(z),sum(z))
random_list = [4, 1, 5, 4, 10, 4] #对应地址为0 1 2 3 4 5
#对列表中对象的出现次数进行统计
print(random_list.count(4))
#返回列表对应元素的指针(序号)
print(random_list.index(4))
#可以选定从哪开始搜寻,从3开始 random_list.index(value, [start, stop]) 左开右闭
random_list.index(4, 3)
print(random_list.index(4,5,6))
#对原始列表排序并修改 从小到大、从大到小 字符串按首字母A-Z顺序排列
random_list.sort()
random_list.sort(reverse = True)
y = ['Steve', 'Rachel', 'Michael', 'Adam', 'Monica', 'Jessica', 'Lester']y.sort(reverse = True)
y.sort()
#不改变原始列表的情况下对列表进行排序
new_list = sorted(y,reverse = True)
print(new_list,y)
# 在列表结尾添加、删除一个对象 可以是数字、字符串等
y.append(3)
y.remove('Steve')
print(y)
#去除列表指定位置的对象,默认是最后一个
y.pop(3)
# 合并列表 在末尾续加的方式来延长列表
y.extend([4,5])
print('random_list+y=',random_list+y)
#在列表指定位置插入对象,可以是列表、数字、字符串
y.insert(4,[4,5])