0
Can someone help me take multiple numbers from an input (a string) and help me map it to INT?
So i can take an input that is just one number, or a prefabricated list and change them into integers and work with them, however i'm trying to take an input of "x, y" and convert those to integers so that i can perform operations. variable = int(input(x, y)) It feels like i should be able to easily figure this out, but i cant. Please help! Thanks :D
4 Réponses
+ 2
James Pink i just split the two input strings at the comma and then made them a list and did the operation list[0]*list[1].
It passed all the test cases so I think its good to go?
+ 1
a = input().split()
for i in range(len(a)): a[i]=int(a[i])
Use variable a which contains all elements as a number instead of str
0
nevermind i got it you can delete thanks :D
0
Brenner Pieszak Which solution did you go with? How does it handle unexpected input?