Input array separated by spaces
- Input array separated by spaces, using split function strings may be separated by a space, e.g. dir = input (). Split ( ''), to obtain an array dir
- However, this string is stored as an array, so in this case, we can use the map function, for example: dir = map (int, input () split ( '').) To obtain an array of int.
- Alternatively, if a known number of variables to store, can be assigned directly Example: ch1, ch2, ch3 = map (int, input.split ( ''), but this time the number of digits to be entered and left the number of variables consistency
Python how to set an EOF stop cycle
Use try :. . . except: the input statement block wrap, when an EOF exception performed except block.
E.g:
while True:
try:
x1,y1,x2,y2=map(int,input().split())
except:
break
Miscellany:
Python is not increment operator, it can use a similar manner as + 1 =
expected an indented block: indentation error