Guest User

Untitled

a guest
Jan 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.52 KB | None | 0 0
  1. While walking on the corridors of the university, you encounter Yky-Pertteli, your archnemesis from the days of elementary school. He smirks at you and opens his laptop to show you a following piece of code:
  2.  
  3.    1 # -*- coding: iso-8859-1 -*-
  4.    2
  5.    3 ad = [["Buy 4", "50% off!"], ["Buy 3", "30% off!"], ["Buy 2", "10% off!"]]
  6.    4 # Replace this line.
  7.    5 print ad
  8.  
  9. Smugly, Yky-Pertteli presents you a challenge: he claims that he can make the program to print {'Buy 4': '50% off!', 'Buy 3': '30% off!', 'Buy 2': '10% off!'} by only replacing the commented fourth line. "Well, that isn't much of a trick" you answer. "Just write ad = {'Buy 4': '50% off!', 'Buy 3': '30% off!', 'Buy 2': '10% off!'} on it. Yky-Pertteli then smiles annoyingly and, to your shock, states boastfully: "I didn't use THAT statement. Only total losers could resort to something so unsophisticated, but I guess that could be expected of you... Let's meet here after the next lecture and see if you have yet come up with an aswer or are you still as hopeless as back then." Then he walks away sneering at you. As you ears start to redden, you think desperately, how would Yky-Pertteli replace the commented line, so that the program prints what he said. There is no way you can let him bully you after all these years! Fortunately, you remember that when in trouble, Python Docs and Google will always help. Since you have no lecture in the next two hours, you still have time to strike back at Yky-Pertteli!
  10.  
  11. Write the line that your archenemy must have used here:
Add Comment
Please, Sign In to add comment