4) c. Pass Statements Examples




You are trapped in your worst enemy’s house. He said to you that he has a file with the names who have hurt him. He has started to write a program that iterates through the lines of the file but he didn’t manage to select the wanted rows.He wants to know if you have ever hurt him, so he told you to print every line where your name appears. If there are such lines, he will kill you. You have to complete his function to print a line if it contains your name. Write a for iteration which iterates through the file and does nothing.

1
Output:




You are in a Taylor Swift concert and just find out that a bomb is placed around the place. You have to decide between
leaving the bombs to explode or tell the people that there is a bomb and start a panic. If the bomb causes less damage than the panic you have to do nothing, otherwise tell the people that there is a bomb.

1
Output:




You are the most qualified programmer of your nation and you are trapped in the Great War by the enemy. They need a
program that prints the decoded message of your communication lines if the message contains the word “war” or “attack”.
Write a function that does nothing to fool the enemy and save your and your friend’s life.

1
Output:




The world is at the beginning of a new crisis. Some new bacteria is killing people and spreading very fast. You need to decide where to help and where to send your resources. If a city has more than 50% of infection level you cannot help anymore.When the level is between 30 and 49% you can help them, you can send your resources there. If the level is between 10 and 29% you can wait if they solve by themselves or they need help. In this case you do not have to do anything.If the infection level is less than 10% you can stop the infection, you must send there some of your resources as soon as possible.

1
2
3
Output:
48  - Resources will be sent
5  - I can solve the city