mercredi 22 novembre 2017

Reading multiple file inputs - TDD in Python

I'm familiar with TDD in Python, however I've encountered a junior-level employment quiz where the quiz provides two sample inputs, the first line being number of testcases T, where 1 <= T <= 10. The second line is T number of testcases, where the last of those test numbers is N. The task is to alter numbers based on specific multiple within a range from 1 to N.

My problem is that I'm stuck figuring out how to decipher N. When I run raw_input(), it only gives me T, however I need to unpack T to confirm N which would subsequently allow me to determine the end of the given range.

Here is my initial stab at the solve, which I was hoping to gain feedback on:

numtest = int(raw_input())
    for i in range(numtest):
        numrange = list(map(int, raw_input().split()))
return numrange

Here's an example test case:

9 --> 'T'

38 95 29 22 15 49 34 70 93 --> T number of cases // N as 93

Aucun commentaire:

Enregistrer un commentaire