You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything in this exercise works fine for me. Are you sure you were editing the "s" string defined at the top?
These are the specific edits I made:
s="Str therae! whatome!"# Length should be 20print("Length of s = %d"%len(s))
# First occurrence of "a" should be at index 8print("The first occurrence of the letter a = %d"%s.index("a"))
# Number of a's should be 2print("a occurs %d times"%s.count("a"))
# Slicing the string into bitsprint("The first five characters are '%s'"%s[:5]) # Start to 5print("The next five characters are '%s'"%s[5:10]) # 5 to 10print("The thirteenth character is '%s'"%s[12]) # Just number 12print("The characters with odd index are '%s'"%s[1::2]) #(0-based indexing)print("The last five characters are '%s'"%s[-5:]) # 5th-from-last to end# Convert everything to uppercaseprint("String in uppercase: %s"%s.upper())
# Convert everything to lowercaseprint("String in lowercase: %s"%s.lower())
# Check how a string startsifs.startswith("Str"):
print("String starts with 'Str'. Good!")
# Check how a string endsifs.endswith("ome!"):
print("String ends with 'ome!'. Good!")
# Split the string into three separate strings,# each containing only a wordprint("Split the words of the string: %s"%s.split(" "))
Ive reached the exercise at the bottom of page
https://www.learnpython.org/en/Basic_String_Operations
And it is IMPOSSIBLE to get the right answer from the instructions.
Is this the quality of LearnX ????????
The text was updated successfully, but these errors were encountered: