Ad
Code
Diff
  • from inspect import getsource
    
    def quine():
        return getsource(quine)
    • from inspect import getsource
    • def quine():
    • q = '"' * 3
    • s = """def quine():
    • q = '"' * 3
    • s = %s%s%s
    • return s %% (q, s, q)
    • """
    • return s % (q, s, q)
    • return getsource(quine)

In a cube, all sides are of equal length. You would only need the length of one side.

Code
Diff
  • class cube:
        def __init__(self, a):
            self.a = a
            
        def volume(self):
            return self.a**3
    • class cube:
    • def __init__(self, a, b, c):
    • def __init__(self, a):
    • self.a = a
    • self.b = b
    • self.c = c
    • def volume(self):
    • return self.a*self.b*self.c
    • return self.a**3
Code
Diff
  • def meaning_of_life_is(*args): return 42
    • def meaning_of_life_is(*args): return 40 + 2
    • def meaning_of_life_is(*args): return 42