<jupyter_start><jupyter_text>بسم الله الرحمن الرحيم<jupyter_code>class Human:
    pass
man = Human()
type(man)
class Human:
    def __init__(self):
        print('I am __init__')
man = Human()
class Human:
    def __init__(self, name):
        self.name = name
st_1 = Human('Ahmed')
st_2 = Human('Ali')
st_1.name
st_2.name
st_1.name = 'Mohammed'
st_1.name
st_2.name
class Human:
    score = 0 # class variable
    def __init__(self, name):
        self.name = name # instance variable
st_1 = Human('Ahmed')
st_2 = Human('Ali')
st_1.name
st_2.name
st_1.score
st_2.score
Human.score = 3
st_1.score
st_1.score = -20
st_1.score
st_2.score
Human.score
st_3 = Human('Mahmoud')
st_3.score
class Human:
    #self.score = 0
    def __init__(self, name, mobile):
        self.name = name
        self.mobile = mobile
        
    def __len__(self):
        pass
class Human:
    faults = 0 # class variable
    
    # instance method
    def __init__(self, name):
        self.name = name
    
    def speak(self):
        print(f'My name is: {self.name}')
    
    # Decorator - code that modifies behaviour of the following block
    @classmethod 
    def make_faults(omnia):
        omnia.faults += 1
        print(omnia.faults)
Human.make_faults()
st_1 = Human('Ali')
st_1.faults
Human.faults
st_1.make_faults()
Human.faults
st_1.faults<jupyter_output><empty_output><jupyter_text>OOP Concepts<jupyter_code>class Human:
    no_faults = 0
    
    def __init__(self, name):
        self.name = name
        
    def speak(self):
        print(f'My name is: {self.name}')
        
    @staticmethod
    def make_faults(cls):
        cls.faults += 1
        
    def __len__(self):
        print('I am inside __len__function')
        print(f'Human Length is: 11')
a = Human('Ahmed')
class obj_1:
    def __init__(self):
        pass
    
    def __len__(self):
        print('I am obj1')
        return 0
class obj_2:
    def __init__(self):
        pass
    
    def __len__(self):
        print('I am obj2')
        return 0
o1 = obj_1()
o2 = obj_2()
a_list = [o1, o2]
# for i in a_list:
#     print(type(i))
def print_obj_length(a):
    for i in a:
        print(len(i))
print_obj_length(a_list)
class Human:
    no_faults = 0
    
    def __init__(self, name):
        self.name = name
        
    def speak(self):
        print(f'My name is: {self.name}')
        
    @staticmethod
    def make_faults(cls):
        cls.faults += 1
        
    def __len__(self):
        return len(self.name)
        
    def __add__(self, a):
        return self.name + a.name
    
    def __sub__(self, a):
        return 12
    
    def __mul__(self, a):
        return 13
    
    def __div__(self, a):
        return 14
    
    def __lt__(self, a):
        if self.name < a.name:
            return True
        return False
    
    def __contains__(self, a):
        return False
a = Human('Amer')
b = Human('Omnia')
'x' in a
a - b
len(a)
len(b)<jupyter_output><empty_output><jupyter_text>Inheritance<jupyter_code>class Human:
    no_faults = 0
    
    def __init__(self, name):
        self.name = name
        
    def speak(self):
        print(f'My name is: {self.name}')
        
    @staticmethod
    def make_faults(cls):
        cls.faults += 1
class Employee(Human):
    def __init__(self):
        super(Employee, self).__init__('Ahmed')
        self.salary = 100
e = Employee()
e.name
e.salary
# e.make_faults()
class A:
    def p(self):
        print('inside class a')
class B:
    def p(self):
        print('inside class b')
class C(B,A):
    pass
obj = C()
obj.p()
class Human:
    def __init__(self, name):
        print('inside Human constructor')
        self.name = name
class Mammal:
    def __init__(self, age):
        print('inside Mammal constructor')
        self.age = age
class Employee(Human, Mammal):
    def __init__(self, name, age):
        Human.__init__(self, name)
        Mammal.__init__(self, age)
e = Employee('Amera', 20)
e.age
e.name
def add(x,y):
    return x + y

def add(x,y,z):
    return x + y + z

add(1,2)
def add(x,y,z):
    return x + y + z
add(1,2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11941747572815534, 'fraction_numerical': 0.015776699029126214, 'mean_word_length': 2.2968, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '32876', 'license': 'MIT', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1498, 'n_words': 378, 'path': 'Week-01/ITI-IoT/Day-03/Day-03.ipynb', 'repo_name': 'MohamedHussein21/DSA20', 'size': '4120'}