How to take two value input for an array in pgthin?
Answers
Answered by
0
One solution is to use raw_input() two times.
x, y = raw_input(), raw_input()
Another solution is to use split()
x, y = raw_input().split()
Note that we don’t have to explicitly specify split(‘ ‘) because split() uses any whitespace characters as delimiter as default.
One thing to note in above Python code is, both x and y would be of string. We can convert them to int using another line
Similar questions