In this exercise, you will work with strings and string formatting.
Write a program that reads a sentence, extracts the name of the person and the code word from it, and displays them as shown in the example below. You can assume that the magic word will always be enclosed in double quotation marks (“) and that the sentence will always have the same structure.
Below are some sample executions of the assignment. The text in red represents user input and will logically not be printed by your program.
Geef de zin die het toverwoord bevat.
Mijn naam is Jan en mijn toverwoord is "wovertoord".
Het toverwoord van Jan is "wovertoord". De lengte van het toverwoord is 9 letters.
Geef de zin die het toverwoord bevat.
Mijn naam is Emma en mijn toverwoord is "programmeren".
Het toverwoord van Emma is "programmeren". De lengte van het toverwoord is 12 letters.
s
, s[3]
returns the character at index position 3.s
, you can use the s.index(substring)
method to find the index position of a substring within the string s
.