## Decoding

View as PDF

Points: 20
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Python

Xyene had a dream about a hard problem last night, and this morning he's decided to see if anyone can solve it.

Xyene has some code that does some funky stuff with a secret x, and stores it into a variable y.

def foo():
x = <some secret value you do not know>
y = <some expression involving x you do not know>
def magic(n):
<does something with n>
magic(y)



Your task is simple: print y!

As an added bonus, your solution should not use exec or eval, nor should it import or open files.

• commented on Dec. 26, 2019, 5:18 p.m.

Do we print y after it's been (possibly) modified my magic or do we print its initial value?

• commented on Dec. 9, 2019, 9:00 p.m.

Does this function magic(n) return anything or are there other tricks in magic(n)

• commented on Dec. 9, 2019, 9:43 p.m.

Yes, it returns something. All functions in Python return something, even if that something is None.

>>> import dis
>>> def magic(n):
...     return n
...
>>> dis.dis(magic)
3 RETURN_VALUE
>>> def magic(n):
...     pass
...
>>> dis.dis(magic)
3 RETURN_VALUE
• commented on June 2, 2019, 12:38 p.m. edited

Do not attempt to do this problem in python 3, you are wasting your time.

EDIT: It's been fixed!

• commented on March 9, 2017, 8:40 a.m.

Are x and y assumed to be numerical values?

• commented on Feb. 25, 2018, 2:26 a.m.

Hint: it doesn't matter. Your task is to print it. Who cares what you are printing? print doesn't, so why should you?

• commented on July 8, 2017, 10:03 a.m.

nathanl3 im guessing so or algerbraic expresssions ...