Answer to Question #307516 in Python for jamil

Question #307516

Write a python program that takes a string as an input from the user and then modifies the string in such a way that the string always starts with an uppercase letter and the case of each subsequent letter is the opposite of the previous letter (uppercase character followed by a lowercase character followed by an uppercase character and so on). Finally the modified string is printed to show the user.


1
Expert's answer
2022-03-07T16:52:11-0500
input1 = input('')
string = ''
for i in range(len(input1)):
    if i % 2 == 0:
        string + input1[i].upper()
    else:
        string + input[i].lower()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS