Cities Visited in Two Weeks
Python
25 pts
Cities Visited in Two Weeks
Merhawi travels around Eritrea for two weeks.
- Start with an empty set
visited. - Use a
forloop andadd()to add each city fromweek1. - Use
update()to add all cities from the tupleweek2. - Finally add
"Adi Keyh". - Print the number of cities and the sorted cities.
Expected output:
5 ['Adi Keyh', 'Asmara', 'Keren', 'Massawa', 'Nakfa']
Checklist
- Keep
week1andweek2unchanged and start with an empty setvisited. - Add each city from
week1with a loop andadd(), all cities fromweek2withupdate(), and finally"Adi Keyh". - Print the number of cities and the sorted cities.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
