How to take 2 input in same line in python - code example ...
grabthiscode.com › python › how-to-take-2-input-inMar 06, 2021 · how to take 2 input in same line in python. GlennFromIowa. Code: Python. 2021-03-06 18:48:38. # Python program showing how to # multiple input using split # taking two inputs at a time x, y = input ( "Enter a two value: " ).split () print ( "Number of boys: ", x) print ( "Number of girls: ", y) print () # taking three inputs at a time x, y, z = input ( "Enter a three value: " ).split () print ( "Total number of students: ", x) print ( "Number of boys is : ", y) print ( "Number of girls is
Taking multiple inputs from user in Python - GeeksforGeeks
www.geeksforgeeks.org › taking-multiple-inputsDec 23, 2021 · The developer often wants a user to enter multiple values or inputs in one line. In C++/C user can take multiple inputs in one line using scanf but in Python user can take multiple values or inputs in one line by two methods. Using split() method; Using List comprehension. Using split() method : This function helps in getting multiple inputs from users. It breaks the given input by the specified separator.