3) c. Lists Examples (2)




You are a private investigator and just got a new job from a company that has a spy between his employees. He asked you to find out who is working for him.
Write a program that has a list of at least 6 employees and list them out.

1
2
3
4
5
6
Output:
Carol
Frank
Emil
Josh
Jack




An agent asked you to help him solve the hardest case in his life. You have to solve a quiz for what you need to create the first 12 elements of the Fibonacci set.
Write a program to calculate the first 12 elements of the Fibonacci set and store them into a list.

1
2
Output:
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]




In a world of werewolves, you have to prepared for everything, but also have to be fast. You have the following list of items: apple juice, machete, holy water, electric scooter, silver knife, a photo of your first dog in a metal frame, fire-extinguisher.
Write a program where you reduce your list of items. Using the pop method, remove the unnecessary items by their indexes.
Do not forget, when you remove an item the indexes of the remaining items might change.

1
2
3
4
5
Output:
First:apple juice
Second:photo of your first dog in a metal frame
Third:fire-extinguisher
The remaining items: ['machete', 'holy water', 'electric scooter', 'silver knife']




You are a spy on a mission. To prevent yourself from being spotted, you have to modify the records of a firm.
Create a program with a list of sentences and put your name into the ending of every second element.

1
2
3
4
5
Output:
Before modifications:
['Padrig Beddow', 'The carpenter', 'Edward Mackey and Padrig Beddow', 'Mercy Bennett']
After modifications:
['Padrig Beddow', 'The carpenter John Smith', 'Edward Mackey and Padrig Beddow', 'Mercy Bennett John Smith']




Once upon a time, you were walking on the streets and somebody robbed you. The only way to get back your money is to order alphabetically the whole city. You have 10 minutes to do this.
Write a program where you have a list of names and sort them alphabetically.

1
2
3
4
5
Output:
Original order:
['Frank', 'Emil', 'Josh', 'Jack', 'Carol', 'Botond']
Sorted:
['Botond', 'Carol', 'Emil', 'Frank', 'Jack', 'Josh']




You are closed in a room and the only way to escape is to find the key to the door, but you have thousands of keys. Each key has a sticky with a name on it. Somebody whispered to you from the nearby room, that your key’s sticky will start with your name. You have 10 minutes to find your key unless you will run out of oxygen.
Write a program, that will find every element starting with your name from a list.

1
2
3
Output:
John blablabla
John bla




You are an international assassin. To cover yourself you have to destroy every evidence after each job, but you have only a few minutes. You are using your target computer.
Write a program that removes every record from a list where your name appears.

1
2
3
4
5
Output:
All records:
['Jame blablabla', 'John blablabla', 'Carol blablabla', 'John bla']
Records that not contiains John:
['Jame blablabla', 'Carol blablabla']