Python 4 Analysingstrings

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Reference from this section:

https://www.tutorialspoint.com/python/python_strings.htm
Section: String special operators

Examine this program

Change the value of s to some other country and run the program again. The “in” here is
used to see if the string “spain” is contained in string a.

Exercise 1
Write a program that has a string that contains all the European Union countries. The user
inputs a European country. The program outputs indicates if the inputted country is in the
European Union.

Exercise 2
Can you work out that the statement “not in” does? TOK angle: what ways of knowing did
you use? To work this out, and how can you verify that you are right?
Are you using inductive reasoning or deductive reasoning.

Exercise 3
Click on the above link and goto the section: String special operators
The webpage does give you specific program examples on how use these operators. Work
how 3 operators of your choice work by writing a program.
TOK angle: what ways of knowing are you using.
You can ask me help if you get stuck (this is part of the ways of knowing).

You might also like