def pig_latin():
str = input("please enter:")
if str.startswith('a'):
print(str + "way")
elif str.startswith('e'):
print(str + "way")
elif str.startswith('i'):
print(str + "way")
elif str.startswith('o'):
print(str + "way")
elif str.startswith('u'):
print(str + "way")
else:
lt = []
r = ""
for string in str:
lt.append(string)
lt.insert(len(lt), lt[0])
lt.remove(lt[0])
for s in lt:
r = r + s
print(r + "ay")
pig_latin()
222
#2 输入一个小写英文句子
#this is a test->histay isway away esttay
def pl_sentence():
str = input("please enter:")
str1 = str.split(' ')
str2 = []
for s in str1:
if s.startswith('a'):
str2.append(s + "way")
elif s.startswith('e'):
str2.append(s + "way")
elif s.startswith('i'):
str2.append(s + "way")
elif s.startswith('o'):
str2.append(s + "way")
elif s.startswith('u'):
str2.append(s + "way")
else:
lt = []
r = ""
for string in s:
lt.append(string)
lt.insert(len(lt), lt[0])
lt.remove(lt[0])
for s1 in lt:
r = r + s1
str2.append(r + "ay")
print(str2)
final = ""
for a in str2:
final = final + a + " "
print(final)
pl_sentence()
333
#333 字符串重复最多次的字母及数字 independence
str = input("please enter:")
str1 = set(str)
temp = 0
for s in str1:
if str.count(s) > temp:
temp = str.count(s)
char = s
print(f"重复最多的字母是:{char},重复次数为:{temp}")