<jupyter_start><jupyter_text>create a class for dictonary parsing 1 . write a functoin to give all the keys2  .write a function to give all the values 3 . write a function to throw an exception in case of input is not dictonary4. write a function to take user input and then parse a key and value out of dictonary 5. write a function to insert new key value pair  into dictonary<jupyter_code>class dict_parsing:
    
    def __init__(self,a):
        self.a = a
    
    def getkeys(self):
        if self.notdict():
            return list(self.a.keys())
        
    def getvalues(self):
        if self.notdict():
            return list(self.a.values())
        
    def notdict(self):
        if type(self.a) != dict:
            raise Exception(self.a,'Not a dictionary')
        return 1
    def userinput(self):
        self.a = eval(input())
        print(self.a,type(self.a))
        print(self.getkeys())
        print(self.getvalues())
        
    def insertion(self,k,v):
        self.a[k] = v
d = {"name":"faiz","mobile_number":9873300865,"email_id":"<EMAIL>"}
dict_class = dict_parsing(d)
dict_class.getkeys()
dict_class.getvalues()
dict_class.insertion(15,"bokhari")
list1 = [1,2,3,4,5,6]
dic = dict_parsing(list1)
dic.notdict()
dict_class.userinput()<jupyter_output>{"name":"faiz","mobile_number":9873300865,"email_id":"<EMAIL>"}
{'name': 'faiz', 'mobile_number': 9873300865, 'email_id': '<EMAIL>'} <class 'dict'>
['name', 'mobile_number', 'email_id']
['faiz', 9873300865, '<EMAIL>']<jupyter_text>q1 . Create your own package for all the list function q2 .create your onw package for all the tuple functionq3 . create your own package for all dictonary functionq4 . create your own package for all the set functionrestriction :    always use exception handling    never usr print statement     always use logging while writing a code and log every activity performed by code in respective logging file<jupyter_code>class xyz:
    def __init__(self,a,b,c):
        self.a = a
        self.b = b
        self.c = c
    
    def test(self):
        print("this is my 1 test method of class xyz")
        
    def test1(self):
        print("this is my 2 test method of class xyz")
        
    def test2(self):
        print("this is my 3 test method of class xyz")
        
    def test3(self):
        print("this is my 3 test method of class xyz")
p = xyz(1,2,3)
p.test1()
class xyz1(xyz):
    pass
q = xyz1(3,4,5)
q.test1()
class xyz1(xyz):
    def test1(self):
        print("this is a test method avialable in xyz1")
g = xyz1(4,5,6)
g.test1()
class xyz:
    def __init__(self,a,b,c):
        self.a = a
        self.b = b
        self.c = c
        
    def test(self):
        print("this is a meth of xyz class ")
        
class xyz1:
    def __init__(self,p,q,v):
        self.p = p
        self.v = v
        self.q = q
        
    def test1(self):
        print("this is a meth from class xyz1")
        
class child(xyz1,xyz):
    def __init__(self,*args,**kwargs):
        xyz.__init__(self,*args)
        xyz1.__init__(self,**kwargs)
n = child(4,5,6,p=3,q=4,v=5)
n.p
n.v
class xyz:
    def __init__(self,a,b,c):
        self.a = a
        self.b = b
        self.c = c
        
    def test(self):
        print("this is a meth of xyz class ")
        
class xyz1(xyz):
   
    def test1(self):
        print("this is a meth from class xyz1")
        
class xyz2(xyz1):
    def test2(self):
        print("this is a meth from class xyz2")
        
class xyz3(xyz2):
    def test3(self):
        print("this is a meth from class xyz3")
v = xyz2(1,2,3)
m = xyz3(4,9,10)
class readFile:
    def __init__(self,fileObj, lines):
        self.file = fileObj
        self.lines = lines
    def readFile(self):
        file2=open(self.file,'r')
        line=file2.readline()
        while(line!=""):
            print(line)
            line=file2.readline()

    def writeFile(self):
        content_write = open(self.file,'w')
        content_write.writelines(lines)
        content_write.close()
        
class readFile1(readFile):
    def readFile1(self):
        print("inheritance of readFile class")

file1 = r'test1.txt'
lines = 'Inserted Lines .......'

read_write = readFile1(file1,lines)
read_write.writeFile()
read_write.readFile()

class test:
    def __init__(self,a,b,c):
        self.a = a
        self.b = b
        self.c = c
        
class test1(test):
    pass

u = test(4,5,6)
u.a
v = test1(1,2,3)
v.a
class test:
    def __init__(self):
        self._a = 4 #protected variable
        self.__b = 10 #private variable
class test1(test):
    def __init__(self):
        self._a = 7
        self.__b = 12
u = test()
u._a
u.__b
v = test1()
v._a
v.__b
class test:
    def __init__(self,a,b,c):
        self._a = a
        self.__b = b
        self.c = c
        
class test1(test):
    pass
v = test(4,5,6)
v._a
v._test__b
v.c
u = test1(7,8,9)
u.c
u._a
u._test1__b
u._test__b
class bonousclaculator:
    def __init__(self, empid , emprating) :
        self.empid = empid
        self.emprating = emprating
        self._empmail = "<EMAIL>"
        self.__bonusforratingA = "70%"
        self.__bonusforraringB = "60%"
        self.__bonusforratinC = "40%"
    
    def bonuscalculator(self) :
        if self.emprating == "A":
            bonus = self.__bonusforratingA
            return bonus
        elif self.emprating == "B" :
            bonus = self.__bonusforraringB
            return bonus
        else :
            bonus = self.__bonusforratinC
            return bonus
emp1 = bonousclaculator(101 , "A")
emp2 = bonousclaculator(102 , "B")
emp3 = bonousclaculator(103, "C")
emp1.bonuscalculator()
emp2.bonuscalculator()
emp3.bonuscalculator()
emp1.empid = 104
emp1.empid
emp1.emprating = "B"
emp1.bonuscalculator()
emp1.__bonusforraringB = "90%"
emp1.bonuscalculator()
emp2.emprating
emp2.bonuscalculator()
emp2.__bonusforraringB = "100%"
emp2.bonuscalculator()
emp2.empid = 3548784
emp2.empid
emp2.__bonusforraringB = "fsdfsfagsf"
emp2._bonousclaculator__bonusforraringB
emp2._bonousclaculator__bonusforraringB  = "435456"
emp2._bonousclaculator__bonusforraringB
emp1._empmail
emp1._empmail = "<EMAIL>"
emp1._empmail
#kevy project
def test(a,b):
    return a+b
test(3,4)
test("fazlullah"," bokhari")
class insta:
    def share_stories(self):
        print("this will share my insta story ")
        
class facebook:
    def share_stories(self):
        print("this will shared my facebook story ")
def shared_story(app):
    app.share_stories()
i = insta()
f = facebook()
shared_story(i)
shared_story(f)
class social_media:
    def share_stories(self):
        print("share a story")

    def upload_pictures(self):
        print("this will help you tp uopload picture on social  media")
class insta(social_media):
    def share_stories(self):
        print("this will share my insta story ")
        
class facebook(social_media):
    def share_stories(self):
        print("this will shared my facebook story ")
i = insta()
f = facebook()
f.share_stories()
i.share_stories()
class test(Exception):
    def __init__(self,msg):
        self.msg = msg
try:
    raise(test("this is my own exceptiom class "))
except test as t:
    print(t)
"""q1  create your own class for to achive multiple  , multilevel inheritance 
q2  create your own class to represenet ploymorprism 
q3 create your own class for custome exception
q4 create your own class to achive encaptulation
q5 create your own class to achive method overloading and overriding  . """
# q1  create your own class for to achive multiple  , multilevel inheritance 
class Faiz:
    def __init__(self,name,mob,YT_link):
        self.name = name
        self.mob = mob
        self.yt_link = YT_link
    def printFaizDetails(self):
        print("Name", self.name)
        print("Mobile number: ",self.mob)
        print("YouTube Link: ",self.yt_link)
class Employee(Faiz):
    def getYouTubeLink(self):
        return self.yt_link
class GetEmployeeDetails(Employee):
    def prinDetails(self):
        return self.getYouTubeLink()
g = GetEmployeeDetails('<NAME>',9873300865, 'https://www.youtube.com/channel/UCGKe5Z0tCXeRmrTXRTJg4fA')
g.printFaizDetails()
g.getYouTubeLink()
#Multiple inheritance

# Parent class1
class Batch_number:
    batchnumber = ""
    def __init__(self,a,b,c):
        self.a = a 
        self.b= b 
        self.c = c 
    def batch(self):
        print(self.batchnumber)
 
# Parent class2
class course_name:
    cname = ""
    def course(self):
        print(self.cname)
 
# Child class
class Student(Batch_number, course_name):
    def deets(self):
        print("Batch :", self.batchnumber)
        print("course :", self.cname)
 
# Child class code
s1 = Student(4,5,6)
s1.batchnumber = "2"
s1.cname = "FSDS"
s1.deets()
bn = Batch_number(4,5,6)
bn1 = Batch_number(1,2,3)

bn1.batchnumber
bn1.batchnumber = "sudh"
bn1.batchnumber
bn.batchnumber
Batch_number.batchnumber = "faiz"
bn.batchnumber
bn1.batchnumber
class Batch_number:
    batchnumber = "FSDS"
    
    def __init__(self,a,b,c):
        self.a = a 
        self.b= b 
        self.c = c 
        
    @staticmethod   
    def batch():
        print("this is statics method batch")
  
    def batch1(self):
        print("this is statics method batch one")    
bn = Batch_number(1,2,3)
bn.batch()
Batch_number.batchnumber
Batch_number.a
bn.a
Batch_number.batch1()
bn.batch1()
# 2  create your own class to represenet ploymorprism 
class PersonDetails:
    def __init__(self,name,p_id,add):
        self.name = name
        self.id = p_id
        self.add = add
class Teacher(PersonDetails):
    def printDetails(self):
        name = "Mr." + self.name
        t_id = self.id
        address = self.add
        details = [name,t_id,address]
        return details
class Student(PersonDetails):
    def printDetails(self):
        name = self.name
        t_id = self.id
        address = self.add
        details = [name,t_id,address]
        return details
s = Student("Faiz",9873,"Delhi")
s.printDetails()
t = Teacher("<NAME>",12345,"Banglore")
t.printDetails()
# 3 create your own class for custome exception
class CustomeException(Exception):
    def __init__(self,msg):
        self.msg = msg
try:
    a = int(input("enter first number: "))
    b = int(input("enter second number: "))
    result = a/b
    
    if b == 5:
        raise(CustomeException("This is custome exception class"))
except CustomeException as c:
    print(c)
except ValueError as msg:
    print(msg)
except ZeroDivisionError as msg:
    print(msg)
else:
    try:
        result = a/b
        print("result:" ,result)
    except Exception as e:
        print(e)
# 4 create your own class to achive encaptulation
# 5 create your own class to achive method overloading and overriding
class abc :
    pass
from abc import abstractmethod
class data_project :
    
    @abstractmethod
    def read_file(self) :
        pass
    
    def validate_file_name(slef) :
        pass
    
    def validate_datatype(self) :
        pass
    
    def validate_db_connn(self) :
        pass
    
    def create_connn(self) :
        pass
    
    def insert_data(self) :
        pass
    
    def delete_data(self):
        pass
    
    def update_data(self) :
        pass
    
    def perform_stats(self) :
        pass
    
    def perform_eda(self) :
        pass
    
class test:
    def fun(self):
        print("this is my sample ")
        
    def __str__(self):
        return str("this is function called at the time of print")
t = test()
print(t)
t
# Overloading

class test:
    def __init__(self,a,b,c):
        self.a = a
        self.b = b
        self.c = c
       
    def __str__(self):
        return "overloaded complete"
t = test(4,5,6)
print(t)
def xyz(*args):
    return args
xyz(1,2,5,48,7,8)
xyz("overloading ","example")
#Overriding

class test:
    def __init__(self,a,b,c):
        self.a = a
        self.b = b
        self.c = c
        
    def __str__(self):
        return "overriding"
    
    def class_fun(self):
        print("this is a print from class_fun")
        
class test1(test):
    def class_fun(self):
        print("overriding")
test1_obj = test1(8,9,10)
test_obj = test(10,20,30)
test1_obj.class_fun()
test_obj.class_fun()
#4:31<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11270592073071277, 'fraction_numerical': 0.024465829391616376, 'mean_word_length': 2.608887580929959, 'pattern_counts': {'":': 7, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '283878', 'license': 'MIT', 'n_tokens_mistral': 4422, 'n_tokens_neox': 4258, 'n_words': 1111, 'path': 'Oops.ipynb', 'repo_name': 'fazlullahb0/python', 'size': '12360'}