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.


+3 votes

In this problem, it looks like where you chop up the words in different places in order to get the right words like "brainiac." I was able to output "brainiac" but the code does not work for the other words...

Wondering if anyone has any tips/hints on how you can make this code work for each of the words, not just one

Thanks ^^

asked in CSC201 Spring 2021 by (1 point)

2 Answers

+3 votes

Remember negative indices work for slicing. If you slice the first word with positive indexing and the second with negative indexing you should have some success.

answered by (1 point)
+3 votes

The slicing method is the solution to this question.
For the first word, you would want to slice using positive index.
For the second word, you would want to slice using negative index.
For example:
To get the first 2 characters from the first word,


To get the last 2 characters from the second word,

answered by (1 point)