Project: countries visited
Let's tackle your second project!
For this project you'll use everything you've learned so far. Remember it's absolutely okay (and indeed encouraged) for you to go back to the previous chapters to review what you've already learned while you tackle this project.
In this project you're going to ask the user for a country they have visited. If it's a country our program already knows about, we'll tell the user that we've been to that country as well.
For this, our program will need to know of some countries.
Flow of the program
We'll create a variable that contains a list of countries.
Then, we'll ask the user to enter a country name.
We'll check if that name is inside our list, and if it is we'll tell the user we have also visited that country.
If it's not inside our list, we'll tell the user we have not visited that country yet.
To check whether something is inside a list, you can use Python's in
keyword:
friends = ["Rolf", "Bob", "Anne"]
if "Anne" in friends:
print("Anne is our friend!")
Remember instead of the string "Anne"
you could use a variable instead. I hope that code gives you some idea on how to tackle this project!
Editor
You can tackle your project in this editor: