Challenge No1

Challenge No1

Postby Yoriz » Wed Jun 05, 2013 7:39 pm

Difficulty - Hard

Actually stick to getting on with some coding / learning rather then browsing the net / watching tv / playing games ect.
Due to the reasons discussed here we will be moving to python-forum.io/ on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Yoriz
 
Posts: 1672
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: Challenge No1

Postby metulburr » Wed Jun 05, 2013 7:51 pm

Image
we will be moving to python-forum.io on October 1 2016
more details here
User avatar
metulburr
 
Posts: 2243
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Challenge No1

Postby Yoriz » Wed Jun 05, 2013 7:56 pm

That looks quite acurate apart from the 20% figuring out yesterdays code when its quite likely that you didnt actually manage to write any code yesterday, you put it off for the next day.
Due to the reasons discussed here we will be moving to python-forum.io/ on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Yoriz
 
Posts: 1672
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: Challenge No1

Postby setrofim » Wed Jun 05, 2013 9:46 pm

Yoriz wrote:That looks quite acurate apart from the 20% figuring out yesterdays code when its quite likely that you didnt actually manage to write any code yesterday, you put it off for the next day.

Well, according to the chart, you spend 2% of you time writing "productive code". So the 11% of the time today is spent figuring out what you did the 2% of the time yesterday.
setrofim
 
Posts: 288
Joined: Mon Mar 04, 2013 7:52 pm

Re: Challenge No1

Postby XndrK » Wed Jan 29, 2014 7:36 pm

I want a new challenge!
Proverbs 26:14 describes me a bit too well.

Version: Python 3.4.3

https://github.com/4of92000
https://github.com/PythonForum/
User avatar
XndrK
 
Posts: 208
Joined: Sat Jun 15, 2013 7:57 pm

Re: Challenge No1

Postby micseydel » Wed Jan 29, 2014 7:40 pm

Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
micseydel
 
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Challenge No1

Postby Mekire » Thu Jan 30, 2014 9:38 am

I dun think its fast enuf :?

Code: Select all
import itertools


def has_subset_sum(seq, n=0):
    all_subsets = (itertools.combinations(seq, i) for i in range(1, len(seq)+1))
    return n in (sum(subset) for subsets in all_subsets for subset in subsets)


if __name__ == "__main__":
    test_sequence = {-7, 22, -3, -2, 17, 4, -39}
    print(has_subset_sum(test_sequence))

Halp?
-Mek

http://en.wikipedia.org/wiki/Subset_sum
New Users, Read This
  • Use code tags when posting code.
  • Include any errors with your post (in code tags).
  • Describe your problem; not your chosen solution.
  • Make examples the minimum length to demonstrate your issue.
User avatar
Mekire
 
Posts: 1710
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona


Return to Challenges

Who is online

Users browsing this forum: No registered users and 0 guests