#有变量:a = ' aleX leNb '完成如下操作,
#1 移除a变量对应的值两边的空格,并输出结果,
a = ' aleX leNb '
# b = a.strip()
# print(b)
#2移除a变量左边的‘ al’,并输出结果,
# b = a.lstrip()
# c = b[2:]
# print(c)
#3移除a变量右面的‘Nb’,并输出处理结果;
# a = ' aleX leNb '
# b = a[1:8]
# print(b)
#4 移除变量a的开头a和结尾b,并输出处理结果;
# b = a[2:9]
# print(b)
# 5 判断变量a是否以al开头,并输出结果;
# b = a.startswith('al')
# print(b)
#6 判断变量a是否以NB结尾,并输出结果
# b = a.endswith('NB')
# print(b)
#7 讲变量a中所有的l替换为p,并输出结果
# print(a.replace('l','p',))
#8
#9将变量a对应的值根据所有的i,分割,并输出结果,
a = ' aleX leNb '
#10 将a对应的值都大写,小写,输出结果,
# print(a.upper())
# # print(a.lower())
#11,将a对应的首字母大写,
# b = a.strip()
# c = b.capitalize()
# print(c)
#12 判断变量a里的值x,出现几次,并输出结果,
# print(a.count('X'))
#13从a变量中找到N对应的索引(如果找不到,报错),并输出结果,
# print(a.index('N'))
#14从a变量中找到N对应的索引(如果找不到,返回-1),并输出结果,
# print(a.find('N'))
#15 从a变量中找到X,le对应的索引,并输出结果,
# print(a.find('X'))
# print(a.find('le'))
#16,请输出name 变量对应的值的第二个字符,
# b = a[1]
# print(b)
#17,请输出name 变量对应的值的前三个字符,
# b = a[0:3]
# print(b)
#18,请输出a 变量对应的值的后2个字符,
# b = a[-1:-4:-1]
# print(b)
#19 请输出a 变量对应的值中e所在的索引位置,
# print(a.find('e'))
#有字符串s='132a4b5c'
#通过对li列表的切片形式,形成新的字符串,s1,s1='123'
# s ='132a4b5c'
# s1 = s[0:1] + s[-6:-8:-1]
# print(s1)
#通过对li列表的切片形式,形成新的字符串,s2,s2='a4b'
# s2 = s[3:6]
# print(s2)
#通过对li列表的切片形式,形成新的字符串,s3,s3='1245'
# s ='132a4b5c'
# s3 = s[0:1] + s[2:3] + s[4:5] + s[-2:-3:-1]
# print(s3)
#通过对li列表的切片形式,形成新的字符串s4,s4='3ab'
# s4 = s[1:2] + s[3:4] + s[-3:-4:-1]
# print(s4)
#使用while和for循环,分别打印字符串s='asdfer'中的每个元素,
s='asdfer'
# for i in s:
# print(i)
# i = 0
# while 1:
# print(s[i])
# i += 1
# if i == len(s):break
s='asdfer'
# for i in s:
# print(i)
# i = 0
# while 1:
# print(s[i])
# i += 1
# if i == len(s):break
#整数加法计算器,
#如content = input('请输入内容:')#如用户输入:5+9或者5+8,然后进行分割再进行计算,
# content = input('请输入内容:>>>').replace(' ','')
# index = content.find('+')
# a = int(content[0:index])
# b = int(content[index+1:])
# print(a + b)
#输入一系列字符串,统计字符串里的数字有多少个
# s = input('请输入:》》》')
# count = 0
# for i in s:
# if i.isdigit():
# count += 1
# print(count)