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]
7 Antworten
+ 2
output1st, *output2nd = input().split()
try:
output2nd = list(map(int, output2nd))
except ValueError:
output2nd = list(map(float, output2nd))
print(output1st)
print(output2nd)
+ 2
You can / could solve this with split. No ready code necessary.
+ 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.
0
Simply split() the input.
0
i did bro but 2nd input is list 😤😤😤😤how
0
thnku rodwy
- 2
read the qustion carefully
one input is str and second input is list and plz give me code for this solution