Lesson5 單元的題目就像在玩邏輯一樣
東切西切然後組合起來
t = input()
print(t[2])
print(t[-2])
print(t[:5])
print(t[:-2])
print(t[::2])
print(t[1::2])
print(t[::-1])
print(t[::-2])
print(len(t))
t = input()
print(len(t.split(" ")))
t = input()
print(t[(len(t) + 1) // 2:] + t[:(len(t) + 1) // 2])
t = input()
print(t.split(" ")[1], t.split(" ")[0])
t = input()
if t.count('f')>1:
print(t.find('f'), t.rfind('f'))
elif t.count('f')==1:
print(t.find('f'))
else:
print('')
t = input()
if t.count('f')==0:
print(-2)
elif t.count('f')==1:
print(-1)
else:
print(t.find('f', t.find('f')+1))
t = input()
print(t[:t.find('h')]+t[t.rfind('h')+1:len(t)+1])
t = input()
t1 = t[t.find('h'):t.rfind('h')+1]
print(t[:t.find('h')]+t1[::-1]+t[t.rfind('h')+1:len(t)+1])
t = input()
print(t.replace('1', 'one'))
t = input()
print(t.replace('@', ""))
find()
和rfind()
完成t = input()
print(t[:t.find('h')+1]+t[t.find('h')+1:t.rfind('h')].replace("h", "H")+t[t.rfind('h'):])
t = input()
o = ''
for i in range(len(t)):
if i%3!=0:
o += t[i]
print(o)