quick Python question regarding running testcases locally (need some help)

Правка en1, от yazzz, 2021-08-11 15:36:21

Hey, (sorry for my English)

quick summary of my question does anyone know the Python equivalent of this command from c++ "g++ -std=c++11 -O2 -Wall cf.cpp -o test". Basically, I just want to produce a binary file named test for my python code, so I can just run this command ./test < in (where the file in will have the sample test cases).

This works very effortlessly in c++ but I have not found any solution so far using Python.

Say I have this Python Code:

t=int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split()))
print(*a)

I want to just print the information from in, which should help me test the code a lot faster.

where for example the file in would contain:

2 3 1 2 3 4 1 2 3 4

Any help would be much appreciated! thanks in advance.

Теги python, input, #testcase

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский yazzz 2021-08-11 18:47:56 202
en5 Английский yazzz 2021-08-11 15:40:39 0 (published)
en4 Английский yazzz 2021-08-11 15:40:19 15
en3 Английский yazzz 2021-08-11 15:39:47 10
en2 Английский yazzz 2021-08-11 15:37:23 20 (saved to drafts)
en1 Английский yazzz 2021-08-11 15:36:21 891 Initial revision (published)