-
Notifications
You must be signed in to change notification settings - Fork 0
/
oops.py
69 lines (52 loc) · 1.41 KB
/
oops.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'''class student:
def pass_fail(self):
if self.marks <40 :
return False
else:
return True
student1 = student()
student1.name = "Amar"
student1.marks = 75
did_he_pass = student1.pass_fail()
print(did_he_pass)
student2 = student()
student2.name = "Raghu"
student2.marks = 40
did_he_pass = student2.pass_fail()
print(did_he_pass)
student3 = student()
student3.name = "shiva"
student3.marks = 35
did_he_pass = student3.pass_fail()
print(did_he_pass)'''
class student:
def pass_fail(self):
if self.marks >= 40:
return True
else:
return False
def __init__(self, name, marks, age):
self.name = name
self.marks = marks
self.age = age
student1 = student("amar", 85, 15)
student2 = student("raghu", 35, 14)
print("student1 name is :", student1.name)
print("student1 marks is :", student1.marks)
print("student1 age is :", student1.age)
did_he_pass = student1.pass_fail()
print("student1 is pass :", did_he_pass)
did_he_pass = student2.pass_fail()
print("student2 is pass :", did_he_pass)
class triangle:
def __init__(self,a,b,c):
self.a = a
self.b = b
self.c = c
def tri_peremetr(self):
result = self.a +self.b + self.c
return result
t1 = triangle(3,4,5)
pere_meter = t1.tri_peremetr()
print("the perimeter of t1 triangle is :" , pere_meter)
print(isinstance(t1,triangle))