Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread K. Elo
Hi! Here one possible solution: --- snip --- land = [10,20,30,40,110,50,18,32,5] landlength=len(land) winnersplit=[] for i in range(landlength-2): for j in range(landlength-1-i): splitsums=[sum(land[0:(i+1)]), sum(land[(i+1):(i+j+2)]), sum(land[(i+j+2):landlength])] differences

Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread K. Elo
Hi! Could it be, "Nuen9", that you would like to find a split where the split sums are close to each other? In other words, you define the number of splits (in your example: 3) and the algortihm should test all possible combinations and select the split where the sum differences are smallest.

Re: merging two csv files

2016-03-03 Thread K. Elo
Hi! Is this a homework or something you need a quick solution for? For the latter: 'man paste' (on Linux) :) Anyway, some sample data and code would be good. BR, Kimmo 03.03.2016, 11:50, m.t.e...@student.rug.nl wrote: Hey! I want to merge column-wise two csv files, say: file1.csv and file2.

Re: SSL certification fails / tweepy [SOLVED]

2016-01-14 Thread K. Elo
Hi! 14.01.2016, 09:59, dieter wrote: "SSL_VERIFICATION_FAILED" is an error which occurs when an SSL ("https") connection is established. It happens when the SSL certificate (of the server and/or client) does not contain expected data - e.g. the certificate is no longer (or not yet) valid or its

SSL certification fails / tweepy

2016-01-13 Thread K. Elo
Dear list members! I have written I small python script for twitter mining utilising the 'tweepy' library. Since a couple of days I cannot use the script anymore, due to a "ssl certificate verification failed" error. The authentication with Twitter API succeess, but when I try to run the foll

Re: nested loops

2013-02-27 Thread K. Elo
Hi! > leonardo writes: how can i have it print a row of stars beside each number, like this?: how many seconds?: 5 5 * * * * * 4 * * * * 3 * * * 2 * * 1 * blast off! --- snip --- sec = int(input("How many seconds? ")) for i in range(0,sec): print str(sec-i)+":"+" *"*(sec-i) print

Re: Keyboard hook in linux

2013-01-13 Thread K. Elo
Hi! Thanks, Michael, for your quick - and heplful - reply. 13.01.2013 18:46, Michael Torrie wrote: You're wrong. curses does offer a direct solution to this. Check the docs. Also here's a nice intro document for Python 3: http://docs.python.org/dev/howto/curses.html You are right :) The do

Keyboard hook in linux

2013-01-13 Thread K. Elo
Hi! I am working on a small console app for linux. The idea is to display some sensor values and the screen should update itself in, say, every 10 seconds. The user should have the possibly to change some configurations or gwt help by pressing different keys (like you can do when running e.g

Re: please i need explanation

2013-01-11 Thread K. Elo
Hi! Since there is no stated question, I need to guess: n -= 1 (instead of "f -= 1") should work. Or maybe the question was a totally different one... -Kimmo 11.01.2013 17:35, kwakukwat...@gmail.com wrote: def factorial(n): if n<2: return 1 f = 1 while n>= 2: