Hi everybody!
I just started programming in Python, so sorry if this question is a very basic one.
My problem is the following: I would like to start using files including the input for programs to run them. Especially, since I want to possibly attend some contests in some time, I think this would be useful.
Now, I'd like to know how I can do that. I searched all over the internet, but haven't really found any answer that satisfies me.
What I would like to do would be something like the following:
Let's say we have t testcases. For each of those there are n inputs. How would I tell my program that it should the first time take t and the first n values to run, the second time the second line of numbers and so on?
To illustrate I made a little example (not sure if I expressed myself well enough..):
We want to test a program. We get a file with the content
Here t = 2, n = 3.
I am unsure about how to put this into a program. The way I know it from C++, I can just assign variables to each value of the input. However, the only way I have seen this done in Python was by including it into arrays, which confused me a lot since everybody seemed to do it a different way.
I'd greatly appreciate your help! Please tell me if you have any questions or if I did not express myself clearly. I think I did not really describe my problem too well, but this is the best way I can think of right now.