View as PDF

Submit solution

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

Problem type
Allowed languages

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>

<your submission code goes here>

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.


  • 0
    GeeTransit  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?

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

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

    • 1
      Xyene  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)
        2           0 LOAD_FAST                0 (n)
                    3 RETURN_VALUE        
      >>> def magic(n):
      ...     pass
      >>> dis.dis(magic)
        2           0 LOAD_CONST               0 (None)
                    3 RETURN_VALUE

  • 0
    c  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!

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

    Are x and y assumed to be numerical values?

    • 2
      quantum  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?

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

      nathanl3 im guessing so or algerbraic expresssions ...