-
Notifications
You must be signed in to change notification settings - Fork 0
/
Numbers2.py
38 lines (29 loc) · 822 Bytes
/
Numbers2.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
class Numbers:
def __init__(self):
self.Size = 0
self.Arr = list()
def Accept(self):
print("Enter how many elements you want : ")
self.Size = int(input())
print("Please enter the elements")
Value = 0
for i in range(0,self.Size):
Value = int(input())
self.Arr.append(Value)
def Display(self):
print("Elements from list are : ")
for i in range(0,self.Size):
print(self.Arr[i])
def Summation(self):
Sum = 0
for i in range(0,self.Size):
Sum = Sum + self.Arr[i]
return Sum
def main():
obj = Numbers()
obj.Accept()
obj.Display()
Output = obj.Summation()
print("Summation of all elements is : ",Output)
if __name__ == "__main__":
main()