i want to take inputs like this 10 12
13 14
15 16
..
how to take this input , as two diffrent integers so that i can multiply them in python after every 10 and 12 there is newline
i want to take inputs like this 10 12
13 14
15 16
..
how to take this input , as two diffrent integers so that i can multiply them in python after every 10 and 12 there is newline
I'm not sure I understood your problem very well, it seems you want to parse two int separated from a space.
In python you do:
Explanation:
raw_input takes everything you type (until you press enter) and returns it as a string, so:
In s you have now '10 12', the two int are separated by a space, we split the string at the space with
now you have a list of strings, you want to convert them in int, so:
then you assign each member of the list to a variable (a and b) and then you do the product a*b
You could use regular expressions (
re
-module)