. Write a code snippet that can arrange the alphabets of a name entered by user in alternate
cases. Note: Ignore white spaces.
Answers
Answered by
2
def case_convert(name):
chars = list(name)
for i in range(len(chars)):
if chars[i].isspace():
pass
elif i % 2 == 0:
chars[i] = chars[i].upper()
else:
chars[i] = chars[i].lower()
return "".join(chars)
print(case_convert((n := input("name: "))))
Similar questions