Re: Help me with this code

2013-11-07 Thread Piet van Oostrum
chovd...@gmail.com writes: > Hi friends > > help me with the following code. Im able to execute the code but getting > wrong output > > def sequence_b(N): > N = 10 > result = 0 > for k in xrange (1,N): > result += ((-1) ** (k+1))/2*k-1 > print result > print sequenc

Re: Help me with this code PLEASE

2013-11-06 Thread Grant Edwards
On 2013-11-06, Denis McMahon wrote: > On Wed, 06 Nov 2013 00:35:56 +0200, Nick the Gr33k wrote: > >> Now i realizes i just cannot store lists into it's columns because it >> does not support a collection datatype. > > All databases support storing of collections, but *NOT THE WAY YOU WANT > TO DO

Re: Help me with this code PLEASE

2013-11-06 Thread Joel Goldstick
On Wed, Nov 6, 2013 at 3:49 AM, Mark Lawrence wrote: > On 06/11/2013 01:14, Nick the Gr33k wrote: >> >> >> How, do i i proceed? > > > If at first you don't succeed, keep asking on comp.lang.python until someone > gives me the completely bodged solution that I keep asking for even if it's > complet

Re: Help me with this code PLEASE

2013-11-06 Thread Mark Lawrence
On 06/11/2013 01:14, Nick the Gr33k wrote: How, do i i proceed? If at first you don't succeed, keep asking on comp.lang.python until someone gives me the completely bodged solution that I keep asking for even if it's complete nonsense. -- Python is the second best programming language in t

Re: Help me with this code PLEASE

2013-11-06 Thread Antoon Pardon
Op 05-11-13 22:26, Nick the Gr33k schreef: > I know i'm close to solution, i can feel it but i have some issues. > The code we arr discussing is the following: No you are not. You are just doing random changes, without any understanding. If you had followed my suggestion and actually read the doc

Re: Help me with this code

2013-11-05 Thread Dave Angel
On Tue, 5 Nov 2013 17:51:00 -0800 (PST), chovd...@gmail.com wrote: result += ((-1) ** (k+1))/2*k-1 One of two things are happening here. Maybe both. You're using Python 2.x (and should havesaid so) where integer division is truncated. You're missing around some part of the intende

Re: Help me with this code

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 17:51:00 -0800, chovdary wrote: > Hi friends > > help me with the following code. Im able to execute the code but getting > wrong output [snip code] You have this critical expression in your code: result += ((-1) ** (k+1))/2*k-1 It looks to me like you are using Python 2

Re: Help me with this code

2013-11-05 Thread MRAB
On 06/11/2013 01:51, chovd...@gmail.com wrote: Hi friends help me with the following code. Im able to execute the code but getting wrong output def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 print result print sequ

Re: Help me with this code PLEASE

2013-11-05 Thread Ben Finney
Denis McMahon writes: > You have been told several times by several people how to do this > properly. You insist on using your bodged up solution instead. OK, we'll > all try and help you bodge up a solution[…] Why? No-one here is obligated to help with implementing a solution we agree is bad.

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:54 πμ, ο/η John Gordon έγραψε: The code i provided only worked once before it failed and managed to store this: counterID,host,refs,city,userOS,browser,visits,hits,download - 1, 176-92-96-218.adsl.cyta.gr, Euro

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Wed, 06 Nov 2013 00:35:56 +0200, Nick the Gr33k wrote: > Now i realizes i just cannot store lists into it's columns because it > does not support a collection datatype. All databases support storing of collections, but *NOT THE WAY YOU WANT TO DO IT* You refuse to do it the proper way, so yo

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 22:31, Cameron Simpson wrote: On 05Nov2013 20:09, Nikos wrote: O even better an rdbms than allows complex data such as tuples, lists, dicts to be saved into the db as they are so i dont have to cobvet back and forth each time. If you're just using the db for storage or adhoc and

Re: Help me with this code PLEASE

2013-11-05 Thread bob gailer
There is also the shelve module. It uses pickle to marshal a Python object, then stores it in a file under a key. Sample code from the module documentation: import shelve d = shelve.open(filename) # open -- file may get suffix added by low-level library d[key] = data # store data at key

Re: Help me with this code PLEASE

2013-11-05 Thread Cameron Simpson
On 05Nov2013 20:09, Nikos wrote: > O even better an rdbms than allows complex data such as tuples, > lists, dicts to be saved into the db as they are so i dont have to > cobvet back and forth each time. If you're just using the db for storage or adhoc and arbitrary python objects (and not queryin

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In Nick the Gr33k writes: > The code i provided only worked once before it failed and managed to > store this: > > counterID,host,refs,city,userOS,browser,visits,hits,download > - > 1, 176-92-96-218.adsl.cyta.gr, Europe/Athens,

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 22:28, Nick the Gr33k wrote: Στις 6/11/2013 12:06 πμ, ο/η John Gordon έγραψε: In Nick the Gr33k writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host =

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:15 πμ, ο/η Piet van Oostrum έγραψε: Nick the Gr33k writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE L

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:06 πμ, ο/η John Gordon έγραψε: In Nick the Gr33k writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host = %s''', (cID, host) )

Re: Help me with this code PLEASE

2013-11-05 Thread Piet van Oostrum
Nick the Gr33k writes: > > IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. > > ALL I WANT IT TO DO IS JUST > > 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS > 2. CONVERT LONG STRINGS TO LISTS > 3. ADD SOME CURRENT VALUES TO THOSE LISTS > 4. CONVERT FROM LISTS TO LONG STRINGS

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In Nick the Gr33k writes: > # fetch those columns that act as lists but are stored as > strings > cur.execute('''SELECT refs, visits, downloads FROM visitors > WHERE > counterID = %s and host = %s''', (cID, host) ) > data = cur.fetchone() >

Re: Help me with this code PLEASE

2013-11-05 Thread Chris Angelico
On Wed, Nov 6, 2013 at 8:17 AM, Mark Lawrence wrote: > I've taken a different approach. I've put the contract out to tender and > hereby give you the winners > http://www.mudefordwoodcommunitycentre.co.uk/playgroup-and-tiny-tots/ Sounds good! But I don't see a list of their technologies - do they

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 21:17, Mark Lawrence wrote: On 05/11/2013 20:19, John Gordon wrote: In Nick the Gr33k writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 10:19 μμ, ο/η John Gordon έγραψε: In Nick the Gr33k writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOS

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 20:19, John Gordon wrote: In Nick the Gr33k writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In Nick the Gr33k writes: > IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. > ALL I WANT IT TO DO IS JUST > 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS > 2. CONVERT LONG STRINGS TO LISTS > 3. ADD SOME CURRENT VALUES TO THOSE LISTS > 4. CONVERT FROM LISTS TO LONG STRING

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Tue, 05 Nov 2013 20:09:42 +0200, Nick the Gr33k wrote: > Denis, i have already provided my code trying to do what i need and i > need some commendation on how to make it work. Nick, you're obviously trying to code way above your abilities. If you want me to write your code, you will have to p

Re: Help me with this code PLEASE

2013-11-05 Thread Joel Goldstick
On Tue, Nov 5, 2013 at 1:11 PM, Tobiah wrote: > All this problem arises because MySQL's hasn't got a datatype able to store > an array of elements, a list. > > Um, yes it does. It's called a table. > -- > https://mail.python.org/mailman/listinfo/python-list Perhaps we are splitting hairs, but a

Re: Help me with this code PLEASE

2013-11-05 Thread Tobiah
All this problem arises because MySQL's hasn't got a datatype able to store an array of elements, a list. Um, yes it does. It's called a table. -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 8:02 μμ, ο/η Denis McMahon έγραψε: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. Try starting with something simple. The following is a step by step guide to working out how you need to do this. Follow a

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: > IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. Try starting with something simple. The following is a step by step guide to working out how you need to do this. Follow all the steps. Do not skip any steps. Each stage bu

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 7:41 μμ, ο/η Steven D'Aprano έγραψε: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO LON

Re: Help me with this code PLEASE

2013-11-05 Thread Antoon Pardon
Op 05-11-13 18:41, Steven D'Aprano schreef: > On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: > >> ALL I WANT IT TO DO IS JUST >> >> 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG >> STRINGS TO LISTS >> 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS

Re: Help me with this code PLEASE

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: > ALL I WANT IT TO DO IS JUST > > 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG > STRINGS TO LISTS > 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO LONG > STRINGS SO I CAN STORE SUCCESSFULLY LIST

Re: Help me with this code PLEASE

2013-11-05 Thread mm0fmf
EVERYHTIGN I TRIED FAILED. Maybe try some of the advice you have been given instead? -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Antoon Pardon
> = > > IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. > > ALL I WANT IT TO DO IS JUST > > 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS > 2. CONVERT LONG STRINGS TO LISTS > 3. ADD SOME CURRENT VALUES TO THOSE LISTS > 4. CONVERT