Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+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 (1 point)

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 (1 point)
+3 votes

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

answered by (1 point)
+3

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)

+2

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.

+2

okay i get it, thank you!

...