0% found this document useful (0 votes)
25 views2 pages

Python

The document defines a Telephone class with methods like PrintInfo and AddContact. It then defines a Mobile class that inherits from Telephone and overrides methods like CallICE to handle mobile-specific functionality.

Uploaded by

Agerola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Python

The document defines a Telephone class with methods like PrintInfo and AddContact. It then defines a Mobile class that inherits from Telephone and overrides methods like CallICE to handle mobile-specific functionality.

Uploaded by

Agerola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

class Telephone:

def __init__(self, brand, telephoneType="UnknownType"):


[Link] = [Link](0, 1000000)
[Link] = brand
[Link] = telephoneType
[Link] = {}

def PrintInfo(self):
print([Link], [Link])
for x in [Link]():
print(" ".join(x))

@staticmethod
def CallICE():
print("Method is not implemented")

def AddContact(self, surname, number):


if surname in [Link]:
print("The contact for given surname already exists in memory")
else:
[Link][surname] = number

------------------------------------------------------------------------------

class Mobile(Telephone):
def __init__(self, brand, simCards, activeSimCard):
[Link] = brand
[Link] = simCards if len(simCards) < 3 else simCards[:2]
[Link] = [Link][activeSimCard]
[Link] = "Mobile"
[Link] = [Link](0,1000000)
[Link] = {}

def HasProductDefect(self):
if [Link] == "XYZBadBrand" and [Link] % 333 == 0:
print("This mobile HAS product defect")
elif [Link] != "XYZBadBrand" and [Link] % 999 == 0:
print("This mobile HAS product defect")
else:
print("This mobile HAS NO product defect")

def CallICE(self):
if len([Link]) == 0:
print("There's no number in memory!")
else:
first_person = sorted([Link], key=lambda x: x)
print(first_person[0], [Link][first_person[0]], [Link])
def concatenate_string(string1, string2):
s = ""
for x in range(len(string1)):
s += string1[x]
s += string2[x]
return s

def pascal_triangle(num):
if num == 0:
return []
elif num == 1:
return [[1]]
else:
nrow = [1]
res = pascal_triangle(num-1)
lrow = res[-1]
for x in range(len(lrow)-1):
[Link](lrow[x] + lrow[x+1])
nrow += [1]
[Link](nrow)
return res

You might also like