-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfib.py
110 lines (69 loc) · 1.81 KB
/
fib.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
""""
def main():
print(cal(8))
def cal(n):
if n > 0:
n += cal(n - 1)
return n
if __name__ == '__main__':
main()
class Person:
def __init__(self):
self.__name = ""
def set_name(self, name):
self.__name = name
def get_name(self):
return self.__name
class Patient(Person):
def __init__(self, name, sickness):
self.__sickness = sickness
Person.__init__(name)
def set_sickness(self, sickness):
self.__sickness = sickness
def get_sickness(self):
return self.__sickness
class InvalidInput(ValueError):
def __init__(self, my_input):
super().__init__(f"You enter in incorrect value ${my_input}")
"""
from tkinter import *
from tkinter import messagebox
class WidgetDemo():
def __init__(self):
window = Tk()
window.title("Widget Demo!")
frame1 = Frame(window)
frame1.pack()
button1 = Button(window, text="The Button", command=self.processButton())
button1.pack()
window.mainloop()
def processButton(self):
my_message = messagebox.showinfo("Welcome")
return my_message
WidgetDemo()
"""
class InvalidInput(ValueError):
def __init__(self, my_input):
super().__init__(f"You enter in incorrect value {my_input}")
self.my_input = my_input
class Area:
def __init__(self):
self.x = 0
def set_x(self, n):
if n <= 0:
raise InvalidInput(n)
else:
self.x = n
def __str__(self):
return str(self.x)
def main():
a = Area()
input_value = int(input("Enter in a value greater than 0: "))
a.set_x(input_value)
if input_value <= 0:
print("Invalid input entered")
else:
print(a)
if __name__ == '__main__':
main()
"""