Re: [Tutor] Overriding equality tests in Python

2013-03-22 Thread Mitya Sirenef
On 03/23/2013 12:08 AM, Robert Sjoblom wrote: Hi list. I'll preface this by saying that I am very grateful for all > of you, and thank you in advance to anyone that answers. > > I'm currently working on a roulette simulator, because it seemed like > fun. I found out I needed a way to compare tw

Re: [Tutor] send issue

2013-03-22 Thread Lolo Lolo
>You can use bytes() function: bytes('%d' % 3,  'utf-8') >b'3' >-m   thanks this has solved everything. can i ask if this is an issue only in python 3 where sockets cant send strings? the docs state the argument is a string, but i believe that was for 2.7. I knew nothing about b'' or bytes

[Tutor] Overriding equality tests in Python

2013-03-22 Thread Robert Sjoblom
Hi list. I'll preface this by saying that I am very grateful for all of you, and thank you in advance to anyone that answers. I'm currently working on a roulette simulator, because it seemed like fun. I found out I needed a way to compare two different outcomes, and it was suggested to me that I s

Re: [Tutor] send issue

2013-03-22 Thread Mitya Sirenef
On 03/22/2013 11:29 PM, Lolo Lolo wrote: using a socket im trying to send a message between connections. it was a string and my python complained: > "TypeError: must be bytes or buffer, not str" .. so i put a b infront of the string. now this works fine but the problem is after recieving this

[Tutor] send issue

2013-03-22 Thread Lolo Lolo
using a socket im trying to send a message between connections. it was a string and my python complained:  "TypeError: must be bytes or buffer, not str" .. so i put a b infront of the string. now this works fine but the problem is after recieving this message, i need to send it back with an int

Re: [Tutor] Beep sound

2013-03-22 Thread Steven D'Aprano
On 23/03/13 12:48, Phil wrote: Just out of curiosity how can a beep sound be generated? My interest in this came about because echo -e '\a' no longer works. Also print '\a' doesn't work, presumably for the same reason. The following is also mute: import Tkinter Tkinter.Tk().bell() Print '\a',

[Tutor] Beep sound

2013-03-22 Thread Phil
Just out of curiosity how can a beep sound be generated? My interest in this came about because echo -e '\a' no longer works. Also print '\a' doesn't work, presumably for the same reason. The following is also mute: import Tkinter Tkinter.Tk().bell() Print '\a', under Idle, causes a bell ico

Re: [Tutor] Starting a simple python project

2013-03-22 Thread Mitya Sirenef
On 03/22/2013 05:02 AM, miguel.gua...@hushmail.com wrote: Greetings all! > > > My name is Miguel Guasch, I'm a software tester who's trying to > slowly get into automation, and eventually (in a couple of years) > into development. For that, I need to learn. At the moment I'm > studying computer

Re: [Tutor] Starting a simple python project

2013-03-22 Thread bob gailer
On 3/22/2013 5:02 AM, miguel.gua...@hushmail.com wrote: Greetings all! Hi. I decided to learn python as a side project, so I could get my feet wet with OOP and start actually being productive. I understand the basics of OOP thanks to a class I took about object modelling and design (UML on Ente

Re: [Tutor] Please Help

2013-03-22 Thread Martin A. Brown
Greetings, : I have the following data points. : data = [1,2,0,9,0,1,4] : I like to store in an array and print the odd-indexed points, i.e. 2, 9,1 : (considering index starts at 0) : : I have written the following code which is not running: : : import math : : number_list = [1,2,0,

Re: [Tutor] Please Help

2013-03-22 Thread Asokan Pichai
On Fri, Mar 22, 2013 at 6:07 PM, Arijit Ukil wrote: > I have the following data points. > data = [1,2,0,9,0,1,4] > I like to store in an array and print the odd-indexed points, i.e. 2, 9,1 > (considering index starts at 0) > > *I have written the following code which is** not **running:* > > impo

Re: [Tutor] Please Help

2013-03-22 Thread Andreas Perstinger
Please use a meaningful subject. On 22.03.2013 13:37, Arijit Ukil wrote: I have the following data points. data = [1,2,0,9,0,1,4] I like to store in an array and print the odd-indexed points, i.e. 2, 9,1 (considering index starts at 0) You can simply slice your list: >>> data = [1, 2, 0, 9, 0

[Tutor] Please Help

2013-03-22 Thread Arijit Ukil
I have the following data points. data = [1,2,0,9,0,1,4] I like to store in an array and print the odd-indexed points, i.e. 2, 9,1 (considering index starts at 0) I have written the following code which is not running: import math number_list = [1,2,0,9,0,1,4] number_list_1 = [] for k in range

[Tutor] Starting a simple python project

2013-03-22 Thread miguel . guasch
Greetings all! My name is Miguel Guasch, I'm a software tester who's trying to slowly get into automation, and eventually (in a couple of years) into development. For that, I need to learn. At the moment I'm studying computer engineering in the evenings, and we do a lot of work in C and assem

Re: [Tutor] Please Help

2013-03-22 Thread Alan Gauld
On 22/03/13 07:24, Arijit Ukil wrote: f = open ("digi_2.txt", "r+") lines = f.readlines() for line in lines: number_list = [] for number in line.split(','): number_list.append(float(number)) s_data = [] for i in range(len(number_list)): You hardly ever need to do this, its

Re: [Tutor] Please Help

2013-03-22 Thread suhas bhairav
Hi Arijit, I have modified your program a bit and it is working fine for me. Values greater than 5 are being printed. Here is the code: f = open ("D:\\digi_2.txt", "r+") lines = f.readlines() number_list = [] for line in lines: print line for number in line.split(','):

[Tutor] Please Help

2013-03-22 Thread Arijit Ukil
Hi, I have another small problem. Pls help. I have written the following code: f = open ("digi_2.txt", "r+") lines = f.readlines() for line in lines: number_list = [] for number in line.split(','): number_list.append(float(number)) s_data = [] for i in range(len(number_list)):