liyu19901003
发表于 2018-4-12 09:21:14
l1=['a','e','i','o','u']
l2=list(input('输入一个字符串:'))
l3=[]
num=0
for i in l1 :
if i in l2:
num =num+1
l3.append(l2.index(i))
l2.remove(i)
if i in l2:
num=111
break
else:
l2.insert(l3,i)
if (num == 2) and l2]!=l2]:
l2],l2]=l2],l2]
str2=''.join(l2)
print(str2)
else:
print('None')
小木子c
发表于 2018-7-20 20:19:55
def f(str1):
list0 = ['a','e','i','o','u']
list1 = list(str1)
list2 = []
for each in list1:
if each in list0:
list2.append(each)
length = len(list2)
if length > 2 or length == 0:
print(None)
else:
for each in list0:
if list2.count(each) > 1:
print(None)
return
else:
index1 = list1.index(list2)
index2 = list1.index(list2)
list1 = list2
list1 = list2
for each in list1:
print(each,end='')
foxiangzun
发表于 2019-1-25 15:46:45
def changeAlphabet(str1):
listAlphabet = ['a', 'e', 'i', 'o', 'u']
list1 = list(str1.lower())
flag1, flag2 = 0, 0
for i in list1 :
if i in listAlphabet :
flag1 += 1
for i in set(list1) :
if i in listAlphabet :
flag2 += 1
if (flag1 != 2) or (flag2 != 2) :
print('None')
return
else :
temp = ''
listIndex = []
for i in list1 :
if i in listAlphabet :
listIndex.append(list1.index(i))
temp = list1]
list1] = list1]
list1] = temp
print(''.join(list1))
return
inputStr = input('请输入一组英文字母:')
changeAlphabet(inputStr)
小贤啊哦
发表于 2020-6-4 19:41:23
def fun111(str1):
s=set(str1)
count=0
dirt1=[]
a=['a','e','i','o','u']
for i in s:
if i in a:
count+=1
dirt1.append(i)
if count!=2:
print('None')
else:
a=dirt1
b=dirt1
position_a=str1.index(a)
position_b=str1.index(b)
string=list(str1)
string,string=string,string
print(''.join(string))
kinkon
发表于 2022-9-8 08:20:57
def f164(s):
s = list(s)
n = len(s)
f = {'a','e','i','o','u'}
p = list()
for i in range(n):
if s in f:
p.append((i, s))
if len(p) != 2 or p == p:
return None
s], s] = s], s]
return ''.join(s)