I have 2 inputs: 1 single number and some numbers separated by whitespace:
1 1 2 3 4 5 I want to loop over the second input, and I don't need the first input. I did this, which works:
input() for x in input().split():somecode() But can I go directly to the second input without doing the input() at the beginning or with shorter code?
I tried this code (-2 bytes) but it doesn't work, it needs two input() to work:
a,b=input() for x in b.split():somecode() #Error : not enough values to unpack (expected 2, got 1) a,b=input(),input() for x in b.split():somecode() #OK
printonly once in thesomecodesection, it might be useful to assigninputto a variable and use that to print the output as well. This saves one byte over theopen(0)method, but has conditions to use it \$\endgroup\$