I am trying to take input. But it's not the correct syntax.
a, b, c = (int(x) for x in raw_input().strip(' '))
My idea is to take multiple values from single line which has integers separated by space. How can I do it?
You were very close. It's split
not strip
:
a, b, c = (int(x) for x in raw_input().split())
This will take exactly 3 integers, no more no less. If you want to take an arbitrary amount into a tuple, try this instead:
tup = tuple(int(x) for x in raw_input().split())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With