作业2:
s ='this is a book'
i = s.replace('book','apple')
print(i)
j = s.startswith('this')
print(j)
l = s.endswith('book')
print(j)
a ='this is a book@'
b = a.rstrip('@')
print(b)
作业3:
li = [2,5,6,4,9,10,23]
li.sort(reverse=True)
print(li)
li2 = [2,5,6,4,9,10,23]
print(li2[-1:-4:-2]+li2[-6::-1])
作业4:
j =input("请输入字符串:")
if len(j) >=3:
print(j+'ing')
if j.endswith('ing'):
print(j+'ly')
elif len(j) <3:
print(j)