Code Monkey home page Code Monkey logo

algorithm's People

Watchers

 avatar  avatar

algorithm's Issues

Algorithm/프로그래머스/Level2/후보키.py

from itertools import combinations

#모든 조합을 구함
for i in range(1,n_col+1):
    combi.extend(combinations(range(n_col),i))

final = []

#조합에 대해서 해당 key를 매핑함 
for keys in combi:
     temp = [tuple([item[key] for key in keys]) for item in relation]

========================================================================
학번 이름 전공 학년
[["100","ryan","music","2"],
["200","apeach","math","2"],
["300","tube","computer","3"],
["400","con","computer","4"],
["500","muzi","music","3"],
["600","apeach","music","2"]]


#temp 출력
[('100',), ('200',), ('300',), ('400',), ('500',), ('600',)]
[('ryan',), ('apeach',), ('tube',), ('con',), ('muzi',), ('apeach',)]
[('music',), ('math',), ('computer',), ('computer',), ('music',), ('music',)]
[('2',), ('2',), ('3',), ('4',), ('3',), ('2',)]

[('100', 'ryan'), ('200', 'apeach'), ('300', 'tube'), ('400', 'con'), ('500', 'muzi'), ('600', 'apeach')]
[('100', 'music'), ('200', 'math'), ('300', 'computer'), ('400', 'computer'), ('500', 'music'), ('600', 'music')]
[('100', '2'), ('200', '2'), ('300', '3'), ('400', '4'), ('500', '3'), ('600', '2')]
[('ryan', 'music'), ('apeach', 'math'), ('tube', 'computer'), ('con', 'computer'), ('muzi', 'music'), ('apeach', 'music')]
[('ryan', '2'), ('apeach', '2'), ('tube', '3'), ('con', '4'), ('muzi', '3'), ('apeach', '2')]
[('music', '2'), ('math', '2'), ('computer', '3'), ('computer', '4'), ('music', '3'), ('music', '2')]

[('100', 'ryan', 'music'), ('200', 'apeach', 'math'), ('300', 'tube', 'computer'), ('400', 'con', 'computer'), ('500', 'muzi', 'music'), ('600', 'apeach', 'music')]
[('100', 'ryan', '2'), ('200', 'apeach', '2'), ('300', 'tube', '3'), ('400', 'con', '4'), ('500', 'muzi', '3'), ('600', 'apeach', '2')]
[('100', 'music', '2'), ('200', 'math', '2'), ('300', 'computer', '3'), ('400', 'computer', '4'), ('500', 'music', '3'), ('600', 'music', '2')][('ryan', 'music', '2'), ('apeach', 'math', '2'), ('tube', 'computer', '3'), ('con', 'computer', '4'), ('muzi', 'music', '3'), ('apeach', 'music', '2')]

[('100', 'ryan', 'music', '2'), ('200', 'apeach', 'math', '2'), ('300', 'tube', 'computer', '3'), ('400', 'con', 'computer', '4'), ('500', 'muzi', 'music', '3'), ('600', 'apeach', 'music', '2')]{(1, 2), (0,)}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.