From our work with strings so far, we have seen that we can compare strings using the same relational operators as we have used before: >, ≥ , ==, !=, <, ≤
s == t - which is true if
s and t
contain the same string and false if they do not.s = input(message) - which will prompt the
user with the message and then reads in the entire line of text as a
string.An example of how this may be used:
# s is a string
# p and q are Boolean
s = input("Enter some text")
p = s == "The end"
q = s == "the end"
If the user typed in "The end" p is True and q is False (equals is case sensitive).
Write a program that prompts the user for a line of text, prints it and repeats this until the user types "The end".
The program will print the number of lines that contain the string "is".
Strings has a basic method that you will need for this assignment:
s.find(t) - which returns the position
where substring t appears in
s. If t does
not appear in s, it returns -1.