# data[].attributes.attachment_link.readable_text
1
red
5
black
2
white
4
red
9
green
6
black
7
purple
8
red
9
orange
10
red
1
black
2
orange
3
yellow
4
purple
5
green
6
yellow
7
yellow
8
white
9
white
10
yellow
1
grey
2
blue
3
black
4
blue
5
blue
6
purple
7
grey
8
blue
9
blue
10
orange

# data[].attributes.attachment_link.readable_text
AZIE
100
ALIS
90
KENT
85
FAIZ
82
BOBY
79
SANI
72
RENO
50
JESS
64
EFII
60
DOLY
20

# data[].attributes.headline
Muhamad Adlee Hakimi Bin Mohd Nazlee (Lee)

# data[].attributes.subject
Muhamad Adlee Hakimi Bin Mohd Nazlee (Lee)

# data[].attributes.attachment_caption
 Marked 20evidence NUR 20DIYANA 20AMANI 20KHAIRUDDIN

# data[].attributes.attachment_link.title
Exception Handling and Text File -Marking Criteria NoCode

# data[].attributes.attachment_link.title
Evidence_MUHAMMAD NUR HAMZAH BIN NORAZAM

# data[].attributes.body
class TBookRecord:
    def __init__(self):
        self.title=""
        self.author=""
        self.ISBN=""

newBook=TBookRecord

def newFile():
    newBook.title= input("Book title:")
    newBook.author= input("Book author:")
    newBook.ISBN= int(input("ISBN: "))
    BookDeets=newBook.title+" "+newBook.author+" "+str(newBook.ISBN)

    bookFile= open("book.txt","w")
    address=hash(newBook.ISBN)
    bookFile.seek(address)
    #pickle.dump(BookDeets,bookFile) <-- for binary
    bookFile.write(BookDeets)
    bookFile.close()

def retrieveBook():
    bookFile=open("book.txt","r")
    newBook.ISBN=int(input("Books ISBN? "))
    try:
        address=hash(newBook.ISBN)
        bookFile.seek(address)
        BookDeets=bookFile.readline(40)
        print(BookDeets)
    except:
        print("Book not found")
    bookFile.close()

newFile()
retrieveBook()

# data[].attributes.body
class car:
    def __init__(self, ID, manuDate, owner):
        self.__ID = ID
        self.__manuDate = manuDate
        self.__owner = owner

    def printInfo(self):
        print(self.__ID)
        print(self.__manuDate)
        print(self.__owner)

    def getID(self):
        return self.__ID

    def getDetails(self):
        return str(self.__ID) + " " + self.__manuDate + " " + self.__owner

bugatti = car(12345, "1/1/1111", "Muhammad Nur Hamzah bin Norazam")
lambo = car(65748, "2/2/2222", "Aiman Mandud bin Daud")
fileName = "cars.txt"

#writing data to file

file = open(fileName, 'w')

address = hash(bugatti.getID())
file.seek(address)
file.write(bugatti.getDetails())

address = hash(lambo.getID())
file.seek(address)
file.write(lambo.getDetails())
file.close()

#Reading data to file
try:
    file = open(fileName, 'r')
    searchID = int(input("Enter ID of car: "))
    try:
        address = hash(searchID)
        file.seek(address)
        details = file.read()
        print(details)
    except:
        print("ERROR: ID does not exist")
    file.close()
except IOError:
    print("File not found")

# data[].attributes.body
import pickle

class TcarRecord:
    def __init__(self,n,id,ori):
        self.name = n
        self.registrationNumber = id  #DECLARE id : INT
        self.origin = ori
    def convertToString(self):
        return str(self.name+' '+self.registrationNumber+' '+self.origin)

def addData():
    thisFile = open('CarRecord', 'wb+')
    print('Please enter your car detail')
    n = str(input('Car name : '))
    id = int(input('Car registration number : '))
    ori = str(input('Car origin : '))
    thisCar = TcarRecord(n, id, ori)
    address = hash(thisCar.registrationNumber)
    thisFile.seek(address)
    pickle.dump(thisCar,thisFile)
    thisFile.close()

def retrieve():
    thisFile = open('CarRecord','rb')
    thisCar = TcarRecord('',int(input('Enter registration number to search : ')),'')
    try:
        address = hash (thisCar.registrationNumber)
        thisFile.seek(address)
        thisCar = pickle.load(thisFile)
        print('\n',thisCar.name ,'\n',thisCar.origin )
    except:
        print('ERROR')
    thisFile.close()

retrieve()

# data[].attributes.body
import pickle

class TcarRecord:
    def __init__(self,n,id,ori):
        self.name = n
        self.registrationNumber = id
        self.origin = ori
    def convertToString(self):
        return str(self.name+' '+self.registrationNumber+' '+self.origin)

#serialization

def write():
    thisFile = open('CarRecord','wb')
    print ('Please enter your car detail')
    n = str(input('Car name : '))
    id = str(input('Car registration number : '))
    ori = str(input('Car origin : '))
    thisCar = TcarRecord(n,id,ori)
    pickle.dump(thisCar.convertToString(),thisFile)
    thisFile.close()

def read():
    thisFile = open('CarRecord','rb')
    array = []
    while True:
        try:
            newData = pickle.load(thisFile)
        except EOFError:
            break
        array.append(newData)
    for i in array:
        print(i)
    thisFile.close()

def append():
    thisFile = open('CarRecord','ab')
    print('Please enter your car detail')
    n = str(input('Car name : '))
    id = str(input('Car registration number : '))
    ori = str(input('Car origin : '))
    thisCar = TcarRecord(n, id, ori)
    pickle.dump(thisCar.convertToString(),thisFile)
    thisFile.close()

# data[].attributes.body
import datetime
import pickle
class student:
    def __init__(self):
        self.name = ""
        self.registernumber = 0
        self.dateofbirth = datetime.date
        self.fulltime = True
studentrecord = student()
def writeserial():
    studentfile = open('jah','w+b')
    print("stud details")
    studentrecord.name = input()
    studentrecord.registernumber = input()
    year = int(input())
    month = int(input())
    day = int(input())
    studentrecord.dateofbirth = datetime.date(year,month,day)
    studentrecord.fulltime = bool(input())
    pickle.dump(studentrecord,studentfile)
    studentfile.close()
def readserial():
    studentfile = open('jah','rb')
    try:
        studentrecord = pickle.load(studentfile)
        print(studentrecord.name, studentrecord.registernumber,studentrecord.dateofbirth,studentrecord.fulltime)
    except:
        print("error")
        studentfile.close()
def writerandom():
    studentfile = open("jah","wb+")
    studentrecord.name = input("Full name")
    studentrecord.registernumber = int(input("Registration Number"))
    year = int(input("Year born"))
    month = int(input("Month born"))
    day = int(input("Day born"))
    studentrecord.dateofbirth = datetime.date(year,month,day)
    address = hash(studentrecord.registernumber)
    studentfile.seek(address)
    pickle.dump(studentrecord,studentfile)
    studentfile.close()
def readrandom():
    global studentrecord
    studentfile = open("jah","rb")
    studentrecord.registernumber = int(input("Insert Registration Number"))
    try:
        address = hash(studentrecord.registernumber)
        studentfile.seek(address)
        studentrecord = pickle.load(studentfile)
        print(studentrecord.name,studentrecord.dateofbirth)
    except:
        print("error")
        studentfile.close()

# data[].attributes.body
class TstudentRecord:
    def __init__(self):
        self.name=""
        self.ID=0

def addData():
    stud=TstudentRecord()
    stud.name=input("Name:")
    stud.ID=int(input("ID:"))
    mystud=(stud.name+" "+str(stud.ID))

    myFile=open("stud.txt","w")
    adress=hash(stud.ID)
    myFile.seek(adress)
    myFile.write(mystud)
    myFile.close()

def findData():
    stud=TstudentRecord()
    myFile=open("stud.txt","r")
    stud.ID=(int(input("Enter student id:"))
    try:
        address = hash(stud.ID)
        myFile.seek(address)
        studDetails=myFile.readline()
        print(studDetails)

    except:
        print("Student ID entered not found")

    myFile.close()

findData()

# data[].attributes.body
import datetime
import pickle
class student:
    def __init__(self):
        self.name=''
        self.registerNumber=0
        self.dateOfBirth=datetime.datetime.now()
        self.fullTime=True

studentRecord=student()
def newRecord():
    studentRecord=student()
    studentFile=open('file.txt','a+b')
    print("enter student details")
    studentRecord.name=input('enter name')
    studentRecord.registerNumber=int(input('enter register number'))
    year=int(input('enter year of birth'))
    month=int(input('month of birth'))
    day=int(input('enter day of birth'))
    studentRecord.dateOfBirth=datetime.datetime(year,month,day)
    studentRecord.fullTime=bool(input('enter True for full time or False'))

    pickle.dump(studentRecord,studentFile)
    studentFile.close()
def read():
    studentFile=open('file.txt','rb')
    array=[]
    while True:
        try:
            data=pickle.load(studentFile)
        except EOFError:
            break
        array.append(data.dateOfBirth)
    for i in array:
        print(i)
    studentFile.close()

# data[].attributes.body
import pickle
class student:
    def __init__(self, name, classes, grades):
        self.__name = name
        self.__classes = classes
        self.__grades = grades

    def getInfo(self):
        print(self.__name)
        for i in range(len(self.__classes)):
            print(self.__classes[i], self.__grades[i])

#Adding data to file
ali = student("ALI", ["CS","ENG"], [99,41])
abu = student("ABU", ["MATH", "PHY"], [101, 53])
filename = "grades.txt"
try:
    file = open(filename, "wb")
    pickle.dump(ali, file)
    pickle.dump(abu, file)
    file.close()

except IOError:
    print("File not found")

#Read all data from file
try:
    file = open(filename, "rb")
    #while not EOF
    while True:
        try:
            person = pickle.load(file)
            person.getInfo()
        except EOFError:
            break
    file.close()

except IOError:
    print("File not found")

# data[].attributes.headline
Nur Diyana Amani binti Khairuddin - RANDOM/SEQUENTIAL

# data[].attributes.subject
Nur Diyana Amani binti Khairuddin - RANDOM/SEQUENTIAL

# data[].attributes.body
#21/2/2023

class carRecord :
    def __init__(self):
        self.brand = ""
        self.plateNum = ""

newCar = carRecord()

def newFile() :

    newCar.brand = input("Brand : ")
    newCar.plateNum = int(input("Plate number : "))
    carDetails = newCar.brand+" "+str(newCar.plateNum)

    carFile = open("car.txt","w")
    address = hash(newCar.plateNum)
    carFile.seek(address)
    carFile.write(carDetails)
    carFile.close()

def findCar():

    carFile = open("car.txt","r")
    newCar.plateNum = int(input("Enter plate number of car to find : "))

    try:
        address = hash(newCar.plateNum)
        carFile.seek(address)
        carDetails = carFile.readline()
        print(carDetails)

    except:
        print("ERROR : CAR NOT REGISTERED")

    carFile.close()

newFile()
findCar()

# data[].attributes.body
#21/2/2023

import pickle

class StudentRecord :

    def __init__(self):
        self.name = ""
        self.className = ""

newStudent = StudentRecord()

def writeBFile():

    newStudent.name = input("Name : ")
    newStudent.className = input("Class : ")
    SDetails = newStudent.name+"\n"+newStudent.className

    newBFile = open("Student.dat","wb")
    pickle.dump(SDetails,newBFile)
    newBFile.close()

def appendBFile():

    newStudent.name = input("Name : ")
    newStudent.className = input("Class : ")
    SDetails = newStudent.name+"\n"+newStudent.className

    newBFile = open("Student.dat","ab")
    pickle.dump(SDetails,newBFile)
    newBFile.close()

def readBFile():

    newBFile = open("Student.dat","rb")
    array = [] #new array to add data in

    while True :
        try :
            newData = pickle.load(newBFile) #assigns data line-by-line
        except EOFError :
            break
        array.append(newData) #add data into array
    for i in array:
        print(i) #print data in array

    newBFile.close()


readBFile()

# data[].attributes.body
import pickle

class TstudentRecord:
    def __init__(self):
        self.name = ""
        self.addie = ""
        self.id=""
        self.course = ""

def write():
    myFile = open("student.dat", "w+b")
    myStudent = TstudentRecord()
    myStudent.name = str(input("name? "))
    myStudent.addie = str(input("address? "))
    myStudent.course = str(input("course? "))
    myStudent.id = int(input("id? "))    newRecord=myStudent.name+"\n"+myStudent.addie+"\n"+myStudent.course
    pickle.dump(myStudent, myFile)
    myFile.close()

def read():
        myFile=open("student.dat","rb")
        array=[]
        while True:
            try:
                newData=pickle.load(myFile)
            except EOFError:
                break
            array.append(newData)
        for i in array:
            print(i)
        myFile.close()

def append():
    myFile=open("student.dat","ab")
    myStudent=TstudentRecord()
    myStudent.name = str(input("name? "))
    myStudent.addie = str(input("address? "))
    myStudent.course = str(input("course? "))    newRecord=myStudent.name+"\n"+myStudent.addie+"\n"+myStudent.course
    pickle.dump(newRecord,myFile)
    myFile.close()

write()
read()
append()
read()

# data[].attributes.attachment_link.title
Unit 20 File Processing and Exception handling New

# data[].attributes.body
class TstudentRecord:
    def __init__(self):
        self.name=""
        self.dob=""
        self.age=""

student=TstudentRecord()
student.name="Julia"
student.dob="7/6"
student.age="20"

newRecord= student.name+"\n"+student.dob+"\n"+student.age
studentFile=open("student.txt","w")
studentFile.write(newRecord)
studentFile.close()


def readFile():
    studentFile=open("student.txt","r")
    studentFile.read()
    studentFile.close()

addstudent=TstudentRecord()
addstudent.name="diyana"
addstudent.dob="6/6"
addstudent.age="20"

addedRecord= addstudent.name+"\n"+addstudent.dob+"\n"+addstudent.age

def appendFile():
    addstudent = TstudentRecord()
    addstudent.name = "diyana"
    addstudent.dob = "6/6"
    addstudent.age = "20"

    addedRecord = addstudent.name + "\n" + addstudent.dob + "\n" + addstudent.age

    studentFile=open("student.txt","r")
    studentFile.write(addedRecord)
    studentFile.close()

newStudent=TstudentRecord
newStudent.name=input("Name:")
newStudent.dob=input("DOB:")
newStudent.age=input("age:")
nRecord = newstudent.name + "\n" + newStudent.dob + "\n" + newStudent.age

newFile=open("NewStudent.txt","w")
newFile.write(nRecord)
newFile.close()

newFile=open("NewStudent.txt","r")
newFile.read()
newFile.close()

# data[].attributes.body
class Tstudentrecord:
    def __init__(self,name,address,className):
        self.name=name
        self.address=address
        self.className=className
    def text(self):
        return (self.name +self.address+self.className)

def append(name,address,className):
    fileHandle=open("studentFile",'a')
    data = Tstudentrecord(name,address,className)
    fileHandle.write("\n" + data.text())
    fileHandle.close()
def read():
    fileHandle=open("studentFile",'r')
    for line in fileHandle:
        print(line.strip())
    LineOfText=fileHandle.readlines()
    print(LineOfText)
    fileHandle.close()


print('enter student details')
name=input('name:')
adress=input('adress:')
className=input('class name:')

append(name,adress,className)
read()

# data[].attributes.body
class TstudentRecord:
    def __init__(self, n, a, cn):
        self.__name = n
        self.__address = a
        self.__className = cn
    def getValues(self):
        return (self.__name + "\n"+ self.__address+ "\n"+ self.__className + "\n")

def appendRecord(n, a, cn):
    try:
        file = open("TstudentRecord.txt", "a")
        record = TstudentRecord(n, a, cn)
        file.write(record.getValues())
        file.close()

    except IOError:
        print("File not found")

def readRecords():
    try:
        file = open("TstudentRecord.txt", "r")
        line = file.readline().strip()
        while line != "":
            name = line
            address = file.readline().strip()
            className = file.readline().strip()
            print(name, "", address, "", className)
            line = file.readline().strip()
        file.close()
    except:
        print("File not found")

#existing records
appendRecord("Aiman","Rumah","6 Bestari")
appendRecord("Jah", "Afrika", "5 Bernas")
appendRecord("Lee", "Marikh", "1 Bijak")

#input from user new record
name = input("Enter name: ")
address = input("Enter address: ")
className = input("Enter class name: ")
appendRecord(name, address, className)

readRecords()

# data[].attributes.body
class TstudentRecord:
    def __init__(self,name,add,classname):
        self.name = name
        self.address = add
        self.classname = classname

    def text(self):
        return (self.name +" "+ self.address +" " + self.classname)


def append(n,a,cn):
    FileHandle = open('StudentRecord','a')
    obj = TstudentRecord(n,a,cn)
    FileHandle.write('\n' + obj.text())
    FileHandle.close()

def read():
    FileHandle = open('StudentRecord','r')
    RecordToRead = FileHandle.readline()
    print(RecordToRead)
    FileHandle.close()

append('Orkid Osman','My House','2 Seroja')

print('Enter your record details')
n = input('Name : ')
a = input('Address : ')
cn = input('Class Name : ')
append(n,a,cn)
read()

# data[].attributes.body
class studentrecord:
    def __init__(self,name,add,cname):
        self.name=name
        self.add = add
        self.classname = cname
    def str(self):
        return self.name+"_"+ self.add+"_"+self.classname
def apennd(name, add, cname):
    Fail=open('jah','a')
    jet=studentrecord(name,add,cname)
    Fail.write('\n'+jet.str())
    Fail.close()
def read():
    filehandle = open('jah','r')
    jet = filehandle.read()
    print(jet)
    filehandle.close()
name = input("student name")
add = input("student address")
cname = input("student class")
apennd(name,add,cname)
read()

# data[].attributes.body
class TstudentRecord:
    def __init__(self,n,a,c):
        self.name=n
        self.address=a
        self.classname=c


n=input("Enter name: ")
a=input("Enter address: ")
c=input("Enter class name: ")
student=TstudentRecord(n,a,c)
newStudent=student.name+"\n"+student.address+"\n"+student.classname+"\n"

def append():
    StudentFile = open("Student.txt", "a")
    StudentFile.write(newStudent)
    StudentFile.close()

def read():
    StudentFile = open("Student.txt", "r")
    print(StudentFile.read(100))
    StudentFile.close()

append()
read()

# data[].attributes.body
class TstudentRecord:
    def __init__(self, name, address, className):
        self.name = name
        self.address = address
        self.className = className
        with open("StudentRecord", "w") as myFile:
            myFile.write(str(name))
            myFile.write("\n" + str(address))
            myFile.write("\n" + str(className))

    def appendRecord(self, name, address, className):
        with open("StudentRecord", "a") as myFile:
            myFile.write("\n" + str(name))
            myFile.write("\n" + str(address))
            myFile.write("\n" + str(className))

    def readFile(self):
        with open("StudentRecord", "r") as recordFile:
            for line in recordFile:
                print(line.rstrip())

myRecord = TstudentRecord("Adlee", "sbh", "AL21.4")
myRecord.appendRecord("Hamzah", "phg", "AL21.6")
myRecord.appendRecord("Harun", "pj", "Al21.6")
myRecord.readFile()

# data[].attributes.body
#20/2/2023

class TStudentRecord:
    def __init__(self):
        self.name = ""
        self.address = ""
        self.className = ""

Student = TStudentRecord()
Student.name = "Orkid Osman"
Student.address = "My House"
Student.className = "2 Seroja"
newStudent = Student.name+"\n"+Student.address+"\n"+Student.className

studentFile = open("Student.txt","w")
studentFile.write(newStudent)
studentFile.close()

def readFile():
    studentFile=open("Student.txt","r")
    studentFile.read()
    studentFile.close()

def appendFile():
    addStudent = TStudentRecord()
    addStudent.name = "Diyana"
    addStudent.address = "CS Lab"
    addStudent.className = "21.4"

    newerStudent = "\n"+addStudent.name+"\n"+addStudent.address+"\n"+addStudent.className

    studentFile = open("Student.txt","a")
    studentFile.write(newerStudent)
    studentFile.close()

nStudent = TStudentRecord
nStudent.name = input("Name : ")
nStudent.address = input("Address : ")
nStudent.className = input("Class name : ")
sDetails = nStudent.name+"\n"+nStudent.address+"\n"+nStudent.className

newFile = open("NewStudent.txt","w")
newFile.write(sDetails)
newFile.close()

newFile = open("NewStudent.txt","r")
newFile.read()
newFile.close()

# data[].attributes.attachment_link.title
Amazingly Simple Graphic Design Software – Canva

# data[].attributes.attachment_link.description
Amazingly Simple Graphic Design Software – Canva

# data[].attributes.body
https://docs.google.com/presentation/d/1xKXM124G8EyXvtAt13TbDeMfHHChVsIoBLYefPItmNg/edit?usp=sharing

# data[].attributes.body
#Exercise 3
class student:
    def __init__(self, name, dob, mark):
        self.__name = name
        self.__dateOfBirth = dob
        self.__examMark = mark

    def displayExamMark(self):
        print(self.__examMark)

class fullTimeStudent(student):
    def __init__(self, name, dob, mark):
        student.__init__(self, name, dob, mark)

class partTimeStudent(student):
    def __init__(self, name, dob, mark):
        student.__init__(self, name, dob, mark)

hamzah = fullTimeStudent("hamzah", "21/2/2003", 100)
hamzah.displayExamMark()

mandud = partTimeStudent("aiman", "1/1/2003", 99)
mandud.displayExamMark()

# data[].attributes.body
import datetime

class student:
def __init__(self,name,dateOfBirth,examMark):
self.__name=name
dateOfBirth=dateOfBirth
self.__dateOfBirth=dateOfBirth
self.__examMark=examMark

def displayExamMark(self):
print('Exam Mark',self.__examMark)
print(self.__dateOfBirth)

class PartTime(student):
def __init__(self,name,dateOfBirth,examMark):
student.__init__(self,name, dateOfBirth, examMark)
fullTime=Falseclass FullTime(student):
def __init__(self,name,dateOfBirth,examMark):
student.__init__(name,dateOfBirth,examMark)
fullTime=True

# data[].attributes.body
import datetime
class student:
    def __init__(self,name,dateOfBirth,examMark):
        self.__name = name
        self.__dateOfBirth = dateOfBirth
        self.__examMark = examMark
    def showDetails(self):
        print('Student name is ' + self.__name)
        print('Students birthdate is ' + str(self.__dateOfBirth))
        print('Student exam mark is ' + str(self.__examMark))
    def displayExamMark(self):
        print('The student with name,' + self.__name + ' got a '+ str(self.__examMark) + ' mark in exam')

class partTimeStudent:
    def __init__(self,n,d,m):
        student.__init__(self,n,d,m)
        self.__fulltime = False
class fullTimeStudent:
    def __init__(self,n,d,m):
        student.__init__(self,n,d, m)
        self.__fulltime = True
myStudent = student('Aiman',datetime.date(2003,7,17),69)
myStudent.displayExamMark()

# data[].attributes.body
class student:
    def __init__(self,name, DateofBirth, examMark):
        self.__name = name
        self.__DateofBirth = DateofBirth
        self.__examMark = examMark
        self.fullTimeStudent = True
    def displayExamMark(self):
        print("Exam Marks:" , self.__examMark)
class fullTimeStudent(student):
    def __init__(self,name,DateofBirth):
        student.__init__(self, name, DateofBirth)
        self.fullTimeStudent = True
class partTimeStudent(student):
    def __init__(self,name,DateofBirth):
        student.__init__(self, name, DateofBirth)
        self.fullTimeStudent = False

# data[].attributes.body
import datetime
class student:
    def __init__(self,name,dateOfBirth,examMark):
        self.__name=name
        self.__dateOfBirth=dateOfBirth
        self.__examMark=examMark
        self.__fullTime = True
    def displayExamMark(self):
        print("Student name: "+self.__name)
        print("Exam mark: ",self.__examMark)

class fullTime(student):
    def __init__(self, name, dateOfBirth, examMark):
        student.__init__(self,name,dateOfBirth,examMark)
        self.__fullTime=True

class partTime(student):
    def __init__(self, name, dateOfBirth, examMark):
        student.__init__(self,name ,dateOfBirth,examMark)
        self.__fullTime=False

fullTimer=fullTime("Julia",datetime.date(1998,2,17),98)
partTimer=partTime("Julius",datetime.date(1999,8,21),78)
fullTimer.displayExamMark()
partTimer.displayExamMark()

# data[].attributes.body
#Exercise3
from datetime import date
dateOfBirth=date(2003,11,6)
class Student:
    def __init__(self,name,dateOfBirth,examMark):
        self.__name=name
        self.__dateOfBirth=dateOfBirth
        self.__examMark=examMark
        self.__FullTime=True
    def DisplayMarks(self):
        print("Marks:",self.__examMark)
class FullTime(Student):
    def __init__(self,name,dateOfBirth,examMark):
        Student.__init__(self,name,dateOfBirth,examMark)
        self.__FullTime=True

class PartTime(Student):
    def __init__(self,name,dateOfBirth,examMark):
        Student.__init__(self,name,dateOfBirth,examMark)
        self.__FullTime=False

stud=Student("julia",dateOfBirth,80)
stud.DisplayMarks()

# data[].attributes.headline
NUR DIYANA AMANI KHAIRUDDIN - EXERCISE 3 OOP

# data[].attributes.subject
NUR DIYANA AMANI KHAIRUDDIN - EXERCISE 3 OOP

# data[].attributes.body
#19/01/2023

#EXERCISE 3

from datetime import date
date1 = date(2005,6,19)
date2 = date(2003,11,23)

class Student :

    def __init__(self,name,date,mark):
        self.__name = name
        self.__dateOfBirth = date
        self.__examMark = mark
        self.__fullTS = True

    def displayExamMark(self):
        print("Student Mark :",self.__examMark)

class fullTimeStudent(Student):

    def __init__(self,name,date,mark):
        Student.__init__(self,name,date,mark)
        self.__fullTS = True

class partTimeStudent(Student):

    def __init__(self,name,date,mark):
        Student.__init__(self,name,date,mark)
        self.__fullTS = False

Student1 = Student("Name1",date1,90)
Student1.displayExamMark()

print("\nNext :")
Student2 = Student("Name2",date2,98)
Student2.displayExamMark()

# data[].attributes.body
import datetime

class Student():

    def __init__(self, name, dateOfBirth, examMark):
        self.name = name
        self.dateOfBirth = dateOfBirth
        self.examMark = examMark

    def display_exam_mark(self):
        print(f"Exam Mark : {self.examMark}")

class FullTimeStudent(Student):

    def __init__(self, name, dateOfBirth, examMark):
        Student.__init__(self, name, dateOfBirth, examMark)

class PartTimeStudent(Student):

    def __init__(self, name, dateOfBirth, examMark):
        Student.__init__(self, name, dateOfBirth, examMark)

myFullTimeStudent = FullTimeStudent("Harun", datetime.datetime(2003,10,4), 100)
myPartTimeStudent = PartTimeStudent("Musa", datetime.datetime(2003,4,1), 10)

myFullTimeStudent.display_exam_mark()
myPartTimeStudent.display_exam_mark()

# data[].attributes.body
def area_four():
    base = int(input("Enter base"))
    height = int(input("Enter height"))
    area = base * height
    return area

def area_three():
    base = int(input("Enter base"))
    height = int(input("Enter height"))
    area = 0.5 * base * height
    return area

def area_circle():
    radius = int(input("Enter radius :"))
    area = 3.142 * radius ** 2
    return area

shape = input("Enter shape : ")
if shape == "square" or shape == "rectangle" or shape == "paralellogram":
    area = area_four()
elif shape == "triangle":
    area = area_three()
elif shape == "circle":
    area = area_circle()
else:
    print("Error")
print(f"Area of {shape} is {area}")

# data[].attributes.body
shape = input("Enter shape : ")
if shape == "square" or shape == "rectangle" or shape == "paralellogram":
    base = int(input("Enter base : "))
    height = int(input("Enter height : "))
    area = base * height
elif shape == "triangle":
    base = int(input("Enter base : "))
    height = int(input("Enter height : "))
    area = base * height * 0.5
elif shape == "circle":
    radius = int(input("Enter radius : "))
    area = 3.142 * radius ** 2
else:
    print("Error")
print(f"Area of {shape} is {area}")

# data[].attributes.attachment_link.title
Unit 19 Computational Thinking and Problem Solving -AL21

# data[].attributes.attachment_link.title
Exam Style Questions AL21-Recursion Answer