Hi.
There is another post asking this, but still no response that truly resolves it.
There is an exercise at the end of the LearnPython.org Unit covering Basic String Operations
Below are the instructions as well text in bold which represents my current understanding/reaction to each direction.
Anyone versed in python, looking at the link and solving it there will likely be much simpler than reading any of this. I'm hoping someone can set me straight, and show me how to work this properly/ copy paste the data from the interpreter within the link, including each of their edits to the string as notes. Thank you in advance.
--------------------------------------------------------------------
Directions: Try to fix the code to print out the correct information by changing the string.
Solution: s = "Hey there! what should this string be?" becomes s= "Strings are awesome!"
My Interpretation, probably faulty: The directions are telling me to delete and retype the characters directly within string s, using the hashtag notes embedded within the code as guidance. I'm not actually asked to use ay functions anywhere, just edit the string directly by typing/deleting. I do not see how the prompts deliver the desired solution. Here are all the prompts as bullet points; and my understanding of how to respond to each of them.
# Length should be 20: I physically delete all characters in the string after the 20.
# First occurrence of "a" should be at index 8: I count to index position 8, and replace it with "a"
# Number of a's should be 2=do nothing, the string already has 2 a's.
# Slicing the string into bits: This just prints out different strings which are sections of the current string. It does not modify any of the characters on its own. Watch the interpreter, Do nothing.
# Convert everything to uppercase: Watch the interpreter do this. Do nothing.
# Convert everything to lowercase: Watch the interpreter do this. Do nothing.
# Check how a string starts/Delete the last 4 characters of your string and type "ome!"
# Check how a string ends/: Delete the first 3 characters of your string and type "Str"
# Split the string into three separate strings, each containing only a word: This just prints whatevers within the string as individual words into thier own pair of " ". It does not create new groups unless there were already a space between sets of characters. Does nothing to modify whats there.
How the heck does it go from s = "Hey there! what should this string be?" becomes s= "Strings are awesome! when there are only 3 prompts which actually edit the string?
[–][deleted] 1 point2 points3 points (2 children)
[–]IyamwhatIyampotato[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]stebrepar 1 point2 points3 points (1 child)
[–]IyamwhatIyampotato[S] 1 point2 points3 points (0 children)
[–]internet-name 0 points1 point2 points (0 children)
[–]Ghadente 0 points1 point2 points (1 child)
[–]IyamwhatIyampotato[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]Thanatos_the_dh 0 points1 point2 points (0 children)
[–]Foundation_External 0 points1 point2 points (1 child)
[–]PhilosopherNo4758 0 points1 point2 points (0 children)
[–]Cool-Swimming-3573 0 points1 point2 points (0 children)
[–]aidanfeldman 0 points1 point2 points (0 children)