-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpFast.py
More file actions
31 lines (23 loc) · 707 Bytes
/
cpFast.py
File metadata and controls
31 lines (23 loc) · 707 Bytes
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
from sys import stdin, stdout
# suppose a function called main() and
# all the operations are performed
def main():
# input via readline method
n = stdin.readline()
# array input similar method
arr = [int(x) for x in stdin.readline().split()]
#initialize variable
summation = 0
# calculate sum
for x in arr:
summation += x
# could use inbuilt summation = sum(arr)
# print answer via write
# write method writes only
# string operations
# so we need to convert any
# data into string for input
stdout.write(str(summation))
# call the main method
if __name__ == "__main__":
main()