c=''
for i in range(0,len(S)):
if S[i].isupper() and S[i-1].isalpha()==True and i!=0:
c+=S[i].lower()
elif S[i].islower() and S[i-1].isalpha()==False or i==0:
c+=S[i].upper()
else:
c+=S[i]
return c
Объяснение:
c=''
for i in range(0,len(S)):
if S[i].isupper() and S[i-1].isalpha()==True and i!=0:
c+=S[i].lower()
elif S[i].islower() and S[i-1].isalpha()==False or i==0:
c+=S[i].upper()
else:
c+=S[i]
return c
Объяснение: