0

Snake to Camel (all 5 tests solved)

Hello together I saw that many other people had problems like me, because of the 5th test. It's really frustrated, if u don't know the problem. The problem was, that the first letter in the word of a capital letter. If u want, u can try my code. plist = [] snake = "_" eing = input() mylist = list(eing) if mylist[0].isupper(): letter1 = mylist[0].lower() mylist.pop(0) mylist.insert(0, letter1) total = 0 for i in mylist: if i.isupper(): pos = mylist.index(i) plist.append(pos) total += 1 for k in plist: for t in mylist: if t.isupper(): pos = mylist.index(t) rep = mylist[pos].lower() mylist.pop(pos) mylist.insert(pos,rep) mylist.insert(pos,snake) else: continue result = "".join(mylist) print(result)

15th Jul 2024, 8:14 PM
MN 990
MN 990 - avatar
2 Respostas
+ 1
Really fine! 👍🏾 It is a weakness of mine that I need to improve.
16th Jul 2024, 6:49 AM
MN 990
MN 990 - avatar
0
You are not the only one
16th Jul 2024, 10:50 AM
Into Accelerated
Into Accelerated - avatar