For the most basic (?) we need to use the for statement, islower(), isupper() function. The islower function determines which str is composed of lowercase letters The isupper function determines which str is composed of uppercase letters.
The approximate code is as follows:
mystring = 'AaronMOOYAustraliaMidfielder'
answer = mystring[0]
for idx, char in enumerate(mystring[1:]):
if mystring[idx].islower() and char.isupper():
answer += '-'
answer += char
print(answer)
© 2024 OneMinuteCode. All rights reserved.