Ad
Code
Diff
  • def Hello_Python():
        return "Hello" + " " + "Python!"
    • def Hello_Python():
    • return "Hello Python!"
    • return "Hello" + " " + "Python!"
Code
Diff
  • def add(a, b):
        return (a+b)**2-a**2-b**2-2*a*b+a+b
    • def add(a, b):
    • return a + b
    • return (a+b)**2-a**2-b**2-2*a*b+a+b
Code
Diff
  • def Hello_Python():
        return "Hello Python!"
    • def Hello_Python():
    • return "{} {}!".format(*Hello_Python.__name__.split('_'))
    • return "Hello Python!"
Code
Diff
  • def power_of_two( x ):
        if x == 1:
            return True
        n = 2
        power = 1
        numb = 0
        while numb <= x:
            numb = n**power
            if numb == x:
                return True
            power+=1
        return False
    • def power_of_two( n ):
    • return n & ( n - 1 ) == 0
    • def power_of_two( x ):
    • if x == 1:
    • return True
    • n = 2
    • power = 1
    • numb = 0
    • while numb <= x:
    • numb = n**power
    • if numb == x:
    • return True
    • power+=1
    • return False