Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+3 votes

my code does print cap letters in separate line but it doesn't work the right way when i plug in a word that does include a mix of upper and lower cases . I wwas thinking about using if statements for this but it's still not working. can anyone help?

asked in CSC201 Spring 2021 by (8 points)

2 Answers

+5 votes

Make sure you are using variable[range].lower and variable[range].upper in your print statement. If you want to make certain letters capital/lowercase, use the [ ] in the statements above. you can use a + to join parts of words that need case correcting. For lowercase you need to use a value that includes all letters but the first, and for the uppercase, just the first letter.

answered by (8 points)
+3 votes

Can you elaborate on what's not working the right way?

answered by (434 points)

like it does work if i plug in words like: hello, adam, matteo... but it doesn't when put :sesQUIPedaLIAN ( like a word that has a mix of upper case and lower case)


So to print the word with the first letter in caps, rest lower, you'll concatenate the first letter.upper() + the rest of the word (so like word[1:].lower()). Then you can use a for loop to print the individual letters doing .upper() for each character.


okay i get it, thank you!