输入存在于s语言的句子或文本中:Isis thasat yousour sisisteser?
输出存在同一个没有s语言的句子:那是你的妹妹吗?
问题: 我有以下代码但有些东西不起作用。例如,我不能在if语句之后追加,而我的if语句太过分了。 print(decoding_tekst)也无效。
方法: 我用两个变量迭代文本的不同位置(“元音组”用于存储元音,“解码文本”用于存储辅音,如果“s”用元音组替换它。)
text = input('Enter a text: ')
vowelgroup = []
decoded_text = []
sentence = []
vowel = 'aeiou'
count = 0
for i in text:
if i is not vowel and not "s":
sentence = decoded_text.append(i)
if i is vowel:
vowelgroup = vowelgroup.append(vowel)
if i is "s":
decoded_text = sentence.append(vowelgroup)
count += 1
print(decoded_text)
答案 0 :(得分:0)
您对append
的工作方式感到有些困惑。 append
只是将参数添加到列表的末尾,它返回None
。 E.g:
l = [1,2]
a = l.append(3)
print a # None
print l # [1,2,3]
所以你只需使用它:
l = [1,2]
l.append(3)
print l # [1,2,3]