Re: [Tutor] taking a tuple with input

2013-10-26 Thread Alan Gauld
On 26/10/13 20:32, Siva Cn wrote: p1 = tuple([float(ele) for ele in input('Please type ...').split()]) If you do it all in one line like that you dpn;t need the [] inside the tuple() call. The generator expressoion will work directly. But of course a single line like that will be hard to de

Re: [Tutor] taking a tuple with input

2013-10-26 Thread Mark Lawrence
On 26/10/2013 20:32, Siva Cn wrote: p1 = tuple([float(ele) for ele in input('Please type ...').split()]) p2 = tuple([float(ele) for ele in input('Please type ...').split()]) # input format is : 25.0 30.0 - *Siva Cn* *Python Developer* *http://www.cnsiva.com* ---

[Tutor] taking a tuple with input

2013-10-26 Thread Siva Cn
p1 = tuple([float(ele) for ele in input('Please type ...').split()]) p2 = tuple([float(ele) for ele in input('Please type ...').split()]) # input format is : 25.0 30.0 - *Siva Cn* *Python Developer* *http://www.cnsiva.com* -

Re: [Tutor] taking a tuple with input

2013-10-26 Thread Alan Gauld
On 26/10/13 04:09, Sven Hennig wrote: So how can i get an int tuple with input? You can't. input() reads strings. (assuming Python v3) You need to convert the string yourself. For simple floats you just call float() but there isn't an equivalent conversion function for tuples. You probably wa

Re: [Tutor] taking a tuple with input

2013-10-26 Thread Mark Lawrence
On 26/10/2013 04:09, Sven Hennig wrote: Hey Guys, i'm running Python 3.3.2 on Windows 7 64 Bit I am writing a little script for practice and got a little problem. I wrote a class which got two points in the constructor (p1 and p2). With the function distanceOf from my class i measure the distan

[Tutor] taking a tuple with input

2013-10-26 Thread Sven Hennig
Hey Guys, i'm running Python 3.3.2 on Windows 7 64 Bit I am writing a little script for practice and got a little problem. I wrote a class which got two points in the constructor (p1 and p2). With the function distanceOf from my class i measure the distance between these two points. Everything wo