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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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