3) e. Tuples Examples (2)

You are followed by a strange man. You have to go to a safe place, but also must inform your friends where you will hide. You found a computer but its connection will let you send only one data structure to your friend.
Create a tuple with your name, your safe location and a code to be able to find you.

1
2
Output:
('John Smith', 'Black house at the end of the bridge', 'The weather is always good')




The end of the world is coming but we are able to save exactly 1000 people. The council decided to save only the most famous people in the World but you have only an hour to notify them.
Write a program that saves the most famous people with their phone number and birth year into a list of tuples.

1
2
3
4
Output:
('Angelica', '0656484894', 1987)
('Carol Danvers', '14189463', 1999)
('Mark', '165464513', 1897)




At the agency, you are working for your life. You have to find out who is threatening you and your agent’s life.
Write a program that writes out every name from a list you’ve got from your boss, who is threatening your life. Use tuples where the first element is the name of the person, and the second is a boolean which indicates the person’s safety level. If the level is equal to or more than 3, the person is dangerous.

1
2
3
4
Output:
('Carl', 4)
('John', 3)
('Dracula', 5)




The World is under the threat of alien species. You were asked by the United Space Federation to write a program that calculates the actual threat. You got a database with different species, their military force from 1 to 10 and the planet they came from. The planet’s military force is calculated by summarizing the military force of the different species living on that planet.

1
2
3
4
5
6
Output:
('Planet of apes', 3)
('Reptil Planet', 8)
('Andromeda', 7)
('Pluto', 4)
('Andoria', 6)