+ 1

How to get input like this in python?

Guys I have a problem in which The input is like 10 28 12 5 6 7 1 5 How do I get this as input and process this ? It's four points of a square and I'm gonna use distance between two points formula

6th May 2020, 3:31 PM
Binto_ Sharon
Binto_ Sharon - avatar
4 Respuestas
+ 2
for i in range(0, 4): num1 = int(input()) num2 = int(input()) # you can now use num1 and num2 to do any calculation
6th May 2020, 3:35 PM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 2
a=[] for i in range(4): a.append(input().split())
6th May 2020, 3:36 PM
Abhay
Abhay - avatar
+ 2
Here is a code that should do the job: # assuming input will be: 1,2 3,4 5,6 7,8 inp = [] for i in range(4): [inp.append(list(map(int, input(f'Enter {i+1} pair (sep by comma): ').split(','))))] print(inp) # output will be a list of lists (integer numbers): # [[1, 2], [3, 4], [5, 6], [7, 8]] # access the pairs with: # for i in inp: i[0] is first number, i[1] is second number
6th May 2020, 5:55 PM
Lothar
Lothar - avatar
+ 1
Thanks
11th May 2020, 1:20 AM
Binto_ Sharon
Binto_ Sharon - avatar