0

how to take two inputs in one line in python 3

how to take two inputs in one line ## condition 1st input is string and second input is list like that input > arshan 1 2 3 output1st arshan output2nd [1,2,3] input> farhan 50 60.0 7.6 output1st farhan outout2nd [50,60.0,7.6]

13th Jun 2020, 10:36 PM
Ârshàñ KhÀñ
Ârshàñ KhÀñ - avatar
7 Answers
+ 2
output1st, *output2nd = input().split() try: output2nd = list(map(int, output2nd)) except ValueError: output2nd = list(map(float, output2nd)) print(output1st) print(output2nd)
13th Jun 2020, 11:00 PM
rodwynnejones
rodwynnejones - avatar
+ 2
You can / could solve this with split. No ready code necessary.
13th Jun 2020, 10:41 PM
Sandra Meyer
Sandra Meyer - avatar
+ 1
The result of split() is already an array. You just have to remove a single element or copy the array from index 1 till its end.
13th Jun 2020, 10:58 PM
Sandra Meyer
Sandra Meyer - avatar
0
Simply split() the input.
13th Jun 2020, 10:38 PM
Sandra Meyer
Sandra Meyer - avatar
0
i did bro but 2nd input is list đŸ˜€đŸ˜€đŸ˜€đŸ˜€how
13th Jun 2020, 10:48 PM
Ârshàñ KhÀñ
Ârshàñ KhÀñ - avatar
0
thnku rodwy
13th Jun 2020, 11:00 PM
Ârshàñ KhÀñ
Ârshàñ KhÀñ - avatar
- 2
read the qustion carefully one input is str and second input is list and plz give me code for this solution
13th Jun 2020, 10:40 PM
Ârshàñ KhÀñ
Ârshàñ KhÀñ - avatar