Input : UserID/ContactNumber
Output: user-id/contact-number
I have tried the following code:
s ="UserID/ContactNumber"
list = [x for x in s]
for char in list:
if char != list[0] and char.isupper():
list[list.index(char)] = '-' + char
fin_list=''.join((list))
print(fin_list.lower())
but the output i got is:
user-i-d/-contact-number
list(s)gives you a list of characters, andlistis a bad name for your own variable.