Vashesh's blog

By Vashesh, history, 2 years ago, In English

Hi, This is a python template I am using currently. Similar templates are already available in C++ and I wanted one in python. In case anyone wants to use it, here it is :)

import sys
from os import path
def input():
    return sys.stdin.readline().strip()

    
def solve(n,array):
    # YOUR CODE HERE
    pass

def main():
    # testcases = 1 
    
    testcases = int(input()) # multiple testcases
    for _ in range(testcases):
        n = int(input())
        array = list(map(int,input().split()))
        solve(n,array)
        

if __name__ == "__main__":
    if(path.exists('input.txt')):
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    main()
        

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it