To do this assigment, you will need to look in the Python builtin types docs for strings. Also, look at sequences, since a string is a sequence. You will find useful stuff there, too.
A shell Python program is provided in the navigation area. Download it and save it with your Python programs. Then, open it with VSCode.
Here is a solution to the example Problem 0. with one test case. You should try a couple of cases that might break your solution.
###############Problem 0#################
# Example problem to show how this works.
# arg is a lower-case string with at least two instances
# of the letter q
# Find the substring of arg between the first and last q
#########################################
arg = "quoque"
start = arg.find("q")
end = arg.rfind("q")
my_result = arg[start + 1: end]
result = "uo" ##this is my given result
print(result == my_result) ##prints True if you succeeded.
Here is where you need to exercise care and do a little
testing. I should be able to change the variable (arg
here) to any string that has at least two instances of the
letter q and the print
statement should print
True
. So, check for this by changing your input
variable.