Ad
Code
Diff
  • def return_hundred():
        n = 100000 // 1000
        return n
    
    • def return_hundred():
    • n = 10000 // 100
    • n = 100000 // 1000
    • return n
Code
Diff
  • def return_hundred():
        n = 10000 // 100
        return n
    
    • def return_hundred():
    • n = 100 // 1
    • n = 10000 // 100
    • return n
Code
Diff
  • def return_hundred():
        n = 100 // 1
        return n
    
    • def return_hundred():
    • n = 1000 // 10
    • n = 100 // 1
    • return n
Code
Diff
  • def return_hundred():
        n = 1000 // 10
        return n
    
    • def return_hundred():
    • n = 100
    • n = 1000 // 10
    • return n
Code
Diff
  • def return_hundred():
        n = 100
        return n
    
    • def return_hundred(): return 100
    • def return_hundred():
    • n = 100
    • return n
Code
Diff
  • def return_hundred(): return 100
    
    • def return_hundred():return 100
    • def return_hundred(): return 100
Code
Diff
  • def return_hundred():return 100
    
    • def return_hundred():
    • kk = 100
    • return kk * 100000000000000000000000000000000000000000000000000000000000000 // 100000000000000000000000000000000000000000000000000000000000000
    • def return_hundred():return 100
Recursion
Mathematics
Code
Diff
  • def fibonacci(n, cache={0:0, 1:1}):
        if n in cache:return cache[n]
        cache[n] = fibonacci(n - 1) + fibonacci(n - 2)
        return cache[n]
    • def fibonacci(n, cache={0:0, 1:1}):
    • if n in cache:
    • return cache[n]
    • if n in cache:return cache[n]
    • cache[n] = fibonacci(n - 1) + fibonacci(n - 2)
    • return cache[n]
Code
Diff
  • def no_trespassing(func):
        def grass(lawn):
            res = func(lawn)
            if res is None:
                return 'No trespassing!'
            return func(lawn)
        return grass
    
    @no_trespassing
    def get_of_my_lawn(on_my_lawn):
        if on_my_lawn is True:return 'get of my lawn'
        
    • def no_trespassing(func):
    • def grass(lawn):
    • res = func(lawn)
    • if res is None:
    • return 'No trespassing!'
    • return func(lawn)
    • return grass
    • @no_trespassing
    • def get_of_my_lawn(on_my_lawn):
    • if on_my_lawn is True:
    • return 'get of my lawn'
    • if on_my_lawn is True:return 'get of my lawn'
Code
Diff
  • adeel_gradute=lambda words:' '.join([h for h in words])
        
    • adeel_gradute=lambda words:' '.join([i for i in words])
    • adeel_gradute=lambda words:' '.join([h for h in words])
Code
Diff
  • class LogicGate:
        """LogicGate class"""
        def __init__(self, yin: bool, yang: bool):
            """Initialize attributes"""
            self.yin = yin
            self.yang = yang
    
        def logical_and(self):return self.yin and self.yang
    
        def logical_or(self):return self.yin or self.yang
    
        def logical_xor(self):return (self.yin or self.yang) and (not self.yin or not self.yang)
    
        def logical_nand(self):return not self.logical_and()
    
        def logical_nor(self):return not self.logical_or()
    
        def logical_xnor(self):
            """This function test for Logical Bi-conditional (XNOR)"""
            return not self.logical_xor()
    • class LogicGate:
    • """LogicGate class"""
    • def __init__(self, yin: bool, yang: bool):
    • """Initialize attributes"""
    • self.yin = yin
    • self.yang = yang
    • def logical_and(self):return self.yin and self.yang
    • def logical_or(self):return self.yin or self.yang
    • def logical_xor(self):return (self.yin or self.yang) and (not self.yin or not self.yang)
    • def logical_nand(self):return not self.logical_and()
    • def logical_nor(self):
    • """This function tests for Joint Denial (NOR)"""
    • return not self.logical_or()
    • def logical_nor(self):return not self.logical_or()
    • def logical_xnor(self):
    • """This function test for Logical Bi-conditional (XNOR)"""
    • return not self.logical_xor()
Code
Diff
  • class LogicGate:
        """LogicGate class"""
        def __init__(self, yin: bool, yang: bool):
            """Initialize attributes"""
            self.yin = yin
            self.yang = yang
    
        def logical_and(self):return self.yin and self.yang
    
        def logical_or(self):return self.yin or self.yang
    
        def logical_xor(self):return (self.yin or self.yang) and (not self.yin or not self.yang)
    
        def logical_nand(self):return not self.logical_and()
    
        def logical_nor(self):
            """This function tests for Joint Denial (NOR)"""
            return not self.logical_or()
    
        def logical_xnor(self):
            """This function test for Logical Bi-conditional (XNOR)"""
            return not self.logical_xor()
    • class LogicGate:
    • """LogicGate class"""
    • def __init__(self, yin: bool, yang: bool):
    • """Initialize attributes"""
    • self.yin = yin
    • self.yang = yang
    • def logical_and(self):return self.yin and self.yang
    • def logical_or(self):return self.yin or self.yang
    • def logical_xor(self):return (self.yin or self.yang) and (not self.yin or not self.yang)
    • def logical_nand(self):
    • """This function test for the Negation of the Conjunction (NAND)"""
    • return not self.logical_and()
    • def logical_nand(self):return not self.logical_and()
    • def logical_nor(self):
    • """This function tests for Joint Denial (NOR)"""
    • return not self.logical_or()
    • def logical_xnor(self):
    • """This function test for Logical Bi-conditional (XNOR)"""
    • return not self.logical_xor()
Code
Diff
  • class LogicGate:
        """LogicGate class"""
        def __init__(self, yin: bool, yang: bool):
            """Initialize attributes"""
            self.yin = yin
            self.yang = yang
    
        def logical_and(self):return self.yin and self.yang
    
        def logical_or(self):return self.yin or self.yang
    
        def logical_xor(self):return (self.yin or self.yang) and (not self.yin or not self.yang)
    
        def logical_nand(self):
            """This function test for the Negation of the Conjunction (NAND)"""
            return not self.logical_and()
    
        def logical_nor(self):
            """This function tests for Joint Denial (NOR)"""
            return not self.logical_or()
    
        def logical_xnor(self):
            """This function test for Logical Bi-conditional (XNOR)"""
            return not self.logical_xor()
    • class LogicGate:
    • """LogicGate class"""
    • def __init__(self, yin: bool, yang: bool):
    • """Initialize attributes"""
    • self.yin = yin
    • self.yang = yang
    • def logical_and(self):return self.yin and self.yang
    • def logical_or(self):return self.yin or self.yang
    • def logical_xor(self):
    • """This function test for Exclusive Disjunction or (XOR)"""
    • return (self.yin or self.yang) and (not self.yin or not self.yang)
    • def logical_xor(self):return (self.yin or self.yang) and (not self.yin or not self.yang)
    • def logical_nand(self):
    • """This function test for the Negation of the Conjunction (NAND)"""
    • return not self.logical_and()
    • def logical_nor(self):
    • """This function tests for Joint Denial (NOR)"""
    • return not self.logical_or()
    • def logical_xnor(self):
    • """This function test for Logical Bi-conditional (XNOR)"""
    • return not self.logical_xor()
Code
Diff
  • class LogicGate:
        """LogicGate class"""
        def __init__(self, yin: bool, yang: bool):
            """Initialize attributes"""
            self.yin = yin
            self.yang = yang
    
        def logical_and(self):return self.yin and self.yang
    
        def logical_or(self):return self.yin or self.yang
    
        def logical_xor(self):
            """This function test for Exclusive Disjunction or (XOR)"""
            return (self.yin or self.yang) and (not self.yin or not self.yang)
    
        def logical_nand(self):
            """This function test for the Negation of the Conjunction (NAND)"""
            return not self.logical_and()
    
        def logical_nor(self):
            """This function tests for Joint Denial (NOR)"""
            return not self.logical_or()
    
        def logical_xnor(self):
            """This function test for Logical Bi-conditional (XNOR)"""
            return not self.logical_xor()
    • class LogicGate:
    • """LogicGate class"""
    • def __init__(self, yin: bool, yang: bool):
    • """Initialize attributes"""
    • self.yin = yin
    • self.yang = yang
    • def logical_and(self):return self.yin and self.yang
    • def logical_or(self):
    • """This function tests for Logical Disjunction (OR)"""
    • return self.yin or self.yang
    • def logical_or(self):return self.yin or self.yang
    • def logical_xor(self):
    • """This function test for Exclusive Disjunction or (XOR)"""
    • return (self.yin or self.yang) and (not self.yin or not self.yang)
    • def logical_nand(self):
    • """This function test for the Negation of the Conjunction (NAND)"""
    • return not self.logical_and()
    • def logical_nor(self):
    • """This function tests for Joint Denial (NOR)"""
    • return not self.logical_or()
    • def logical_xnor(self):
    • """This function test for Logical Bi-conditional (XNOR)"""
    • return not self.logical_xor()
Code
Diff
  • class LogicGate:
        """LogicGate class"""
        def __init__(self, yin: bool, yang: bool):
            """Initialize attributes"""
            self.yin = yin
            self.yang = yang
    
        def logical_and(self):return self.yin and self.yang
    
        def logical_or(self):
            """This function tests for Logical Disjunction (OR)"""
            return self.yin or self.yang
    
        def logical_xor(self):
            """This function test for Exclusive Disjunction or (XOR)"""
            return (self.yin or self.yang) and (not self.yin or not self.yang)
    
        def logical_nand(self):
            """This function test for the Negation of the Conjunction (NAND)"""
            return not self.logical_and()
    
        def logical_nor(self):
            """This function tests for Joint Denial (NOR)"""
            return not self.logical_or()
    
        def logical_xnor(self):
            """This function test for Logical Bi-conditional (XNOR)"""
            return not self.logical_xor()
    • class LogicGate:
    • """LogicGate class"""
    • def __init__(self, yin: bool, yang: bool):
    • """Initialize attributes"""
    • self.yin = yin
    • self.yang = yang
    • def logical_and(self):
    • """This function tests for Logical Conjunction (AND)"""
    • return self.yin and self.yang
    • def logical_and(self):return self.yin and self.yang
    • def logical_or(self):
    • """This function tests for Logical Disjunction (OR)"""
    • return self.yin or self.yang
    • def logical_xor(self):
    • """This function test for Exclusive Disjunction or (XOR)"""
    • return (self.yin or self.yang) and (not self.yin or not self.yang)
    • def logical_nand(self):
    • """This function test for the Negation of the Conjunction (NAND)"""
    • return not self.logical_and()
    • def logical_nor(self):
    • """This function tests for Joint Denial (NOR)"""
    • return not self.logical_or()
    • def logical_xnor(self):
    • """This function test for Logical Bi-conditional (XNOR)"""
    • return not self.logical_xor()
Loading more items...