How to take space separated input in Python
![How to take space separated input in Python](https://pythonpoint.net/wp-content/uploads/2020/11/How-to-take-space-separated-input-in-Python-1024x576.jpg)
This is simple, once you know it. In python, you can take space seperated input using the function split()
Lets see an example
a, b, c = input().split() print(a,b,c)
In the above example, 3 input values separated by whitespace are taken. The default separator of split function is any whitespace. The input is assigned to a second to b, and third to c. If we attempt to input more than three values, it will throw a ValueError: too many values to unpack, since the expected number of values are 3.
Output:
![](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-2020-11-16-212340_LI-2-1024x524.jpg)
Subscribe
Login
Please login to comment
0 Discussion