From 867fb1924a53f2a67c6738ed35d8b4b12caf9c60 Mon Sep 17 00:00:00 2001 From: snehasish-20 <63896969+snehasish-20@users.noreply.github.com> Date: Mon, 12 Oct 2020 18:15:46 +0530 Subject: [PATCH] Create quickInputOutput.py --- quickInputOutput.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 quickInputOutput.py diff --git a/quickInputOutput.py b/quickInputOutput.py new file mode 100644 index 0000000..7b808c3 --- /dev/null +++ b/quickInputOutput.py @@ -0,0 +1,36 @@ +# template begins +##################################### + +# import libraries for input/ output handling +# on generic level +import atexit, io, sys + +# A stream implementation using an in-memory bytes +# buffer. It inherits BufferedIOBase. +buffer = io.BytesIO() +sys.stdout = buffer + +# print via here +@atexit.register +def write(): + sys.__stdout__.write(buffer.getvalue()) + +##################################### +# template ends + +# normal method followed +# input N +n = int(raw_input()) + +# input the array +arr = [int(x) for x in raw_input().split()] + +# initialize variable +summation = 0 + +# calculate sum +for x in arr: + summation += x + +# print answer +print(summation)