How do make a dominance using python in set? The Next CEO of Stack OverflowHow do I check whether a file exists without exceptions?Calling an external command in PythonWhat are metaclasses in Python?How can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?How to make a chain of function decorators?How to make a flat list out of list of lists?Does Python have a string 'contains' substring method?

How do I solve this limit?

Grabbing quick drinks

What do "high sea" and "carry" mean in this sentence?

How to make a software documentation "officially" citable?

How do I construct this japanese bowl?

Term for the "extreme-extension" version of a straw man fallacy?

How to get regions to plot as graphics

Can the Reverse Gravity spell affect the Meteor Swarm spell?

Trouble understanding the speech of overseas colleagues

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Is it a good idea to use COLUMN AS (left([Another_Column],(4)) instead of LEFT in the select?

Apart from "berlinern", do any other German dialects have a corresponding verb?

How to safely derail a train during transit?

Increase performance creating Mandelbrot set in python

Science fiction (dystopian) short story set after WWIII

Only print output after finding pattern

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Anatomically Correct Strange Women In Ponds Distributing Swords

What's the point of interval inversion?

Why did we only see the N-1 starfighters in one film?

How can I open an app using Terminal?

Is it safe to use c_str() on a temporary string?

Horror movie/show or scene where a horse creature opens its mouth really wide and devours a man in a stables

Implement the Thanos sorting algorithm



How do make a dominance using python in set?



The Next CEO of Stack OverflowHow do I check whether a file exists without exceptions?Calling an external command in PythonWhat are metaclasses in Python?How can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?How to make a chain of function decorators?How to make a flat list out of list of lists?Does Python have a string 'contains' substring method?










0















I have problem in mycode. I want to compare value which dominance and not dominance is pruned.
mycode is:



def dominan(a,b):
return any([x < y for (x, y) in zip(a, b)])

p1 = ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'D', 'T'): (8, 12, 35, 6, 7)
p2 = ('S', 'B', 'T'): (7, 3, 30, 4, 4)
pk = list(p2.keys())
pv = list(p2.values())
pks = list(p1.keys())
pvs = list(p1.values())
for x in range(0, len(pk)):
if (len(pks) == 0):
pks.append(pk[x])
pvs.append(pv[x])
for l in range(0, len(pks)):
if dominan(pv[x], pvs[l]):
pks.append(pk[x])
pvs.append(pv[x])
res = dict(zip(pks, pvs))
print("result dominance p2 and p1 =", res)


The logical is p2 is not dominated by ('S', 'B', 'D', 'T'): (8, 12, 35, 6, 7) because every value are smaller.



Any can help my problem? Thank you very much..










share|improve this question






















  • what are you trying to do with p1 and p2 dicts and what is your expected result?

    – naivepredictor
    Mar 7 at 14:18











  • my expected output is: ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'T'): (7, 3, 30, 4, 4)

    – lilis gumilang
    Mar 7 at 14:22











  • why SBT included and not SBDT?

    – naivepredictor
    Mar 7 at 14:31











  • because SBDT is dominated by SBT. SBDT is pruned.

    – lilis gumilang
    Mar 7 at 14:32












  • what do you mean by dominated? explain your logic how do you assume SBDT dominates SBT

    – naivepredictor
    Mar 7 at 14:35















0















I have problem in mycode. I want to compare value which dominance and not dominance is pruned.
mycode is:



def dominan(a,b):
return any([x < y for (x, y) in zip(a, b)])

p1 = ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'D', 'T'): (8, 12, 35, 6, 7)
p2 = ('S', 'B', 'T'): (7, 3, 30, 4, 4)
pk = list(p2.keys())
pv = list(p2.values())
pks = list(p1.keys())
pvs = list(p1.values())
for x in range(0, len(pk)):
if (len(pks) == 0):
pks.append(pk[x])
pvs.append(pv[x])
for l in range(0, len(pks)):
if dominan(pv[x], pvs[l]):
pks.append(pk[x])
pvs.append(pv[x])
res = dict(zip(pks, pvs))
print("result dominance p2 and p1 =", res)


The logical is p2 is not dominated by ('S', 'B', 'D', 'T'): (8, 12, 35, 6, 7) because every value are smaller.



Any can help my problem? Thank you very much..










share|improve this question






















  • what are you trying to do with p1 and p2 dicts and what is your expected result?

    – naivepredictor
    Mar 7 at 14:18











  • my expected output is: ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'T'): (7, 3, 30, 4, 4)

    – lilis gumilang
    Mar 7 at 14:22











  • why SBT included and not SBDT?

    – naivepredictor
    Mar 7 at 14:31











  • because SBDT is dominated by SBT. SBDT is pruned.

    – lilis gumilang
    Mar 7 at 14:32












  • what do you mean by dominated? explain your logic how do you assume SBDT dominates SBT

    – naivepredictor
    Mar 7 at 14:35













0












0








0








I have problem in mycode. I want to compare value which dominance and not dominance is pruned.
mycode is:



def dominan(a,b):
return any([x < y for (x, y) in zip(a, b)])

p1 = ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'D', 'T'): (8, 12, 35, 6, 7)
p2 = ('S', 'B', 'T'): (7, 3, 30, 4, 4)
pk = list(p2.keys())
pv = list(p2.values())
pks = list(p1.keys())
pvs = list(p1.values())
for x in range(0, len(pk)):
if (len(pks) == 0):
pks.append(pk[x])
pvs.append(pv[x])
for l in range(0, len(pks)):
if dominan(pv[x], pvs[l]):
pks.append(pk[x])
pvs.append(pv[x])
res = dict(zip(pks, pvs))
print("result dominance p2 and p1 =", res)


The logical is p2 is not dominated by ('S', 'B', 'D', 'T'): (8, 12, 35, 6, 7) because every value are smaller.



Any can help my problem? Thank you very much..










share|improve this question














I have problem in mycode. I want to compare value which dominance and not dominance is pruned.
mycode is:



def dominan(a,b):
return any([x < y for (x, y) in zip(a, b)])

p1 = ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'D', 'T'): (8, 12, 35, 6, 7)
p2 = ('S', 'B', 'T'): (7, 3, 30, 4, 4)
pk = list(p2.keys())
pv = list(p2.values())
pks = list(p1.keys())
pvs = list(p1.values())
for x in range(0, len(pk)):
if (len(pks) == 0):
pks.append(pk[x])
pvs.append(pv[x])
for l in range(0, len(pks)):
if dominan(pv[x], pvs[l]):
pks.append(pk[x])
pvs.append(pv[x])
res = dict(zip(pks, pvs))
print("result dominance p2 and p1 =", res)


The logical is p2 is not dominated by ('S', 'B', 'D', 'T'): (8, 12, 35, 6, 7) because every value are smaller.



Any can help my problem? Thank you very much..







python






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 14:08









lilis gumilanglilis gumilang

93




93












  • what are you trying to do with p1 and p2 dicts and what is your expected result?

    – naivepredictor
    Mar 7 at 14:18











  • my expected output is: ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'T'): (7, 3, 30, 4, 4)

    – lilis gumilang
    Mar 7 at 14:22











  • why SBT included and not SBDT?

    – naivepredictor
    Mar 7 at 14:31











  • because SBDT is dominated by SBT. SBDT is pruned.

    – lilis gumilang
    Mar 7 at 14:32












  • what do you mean by dominated? explain your logic how do you assume SBDT dominates SBT

    – naivepredictor
    Mar 7 at 14:35

















  • what are you trying to do with p1 and p2 dicts and what is your expected result?

    – naivepredictor
    Mar 7 at 14:18











  • my expected output is: ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'T'): (7, 3, 30, 4, 4)

    – lilis gumilang
    Mar 7 at 14:22











  • why SBT included and not SBDT?

    – naivepredictor
    Mar 7 at 14:31











  • because SBDT is dominated by SBT. SBDT is pruned.

    – lilis gumilang
    Mar 7 at 14:32












  • what do you mean by dominated? explain your logic how do you assume SBDT dominates SBT

    – naivepredictor
    Mar 7 at 14:35
















what are you trying to do with p1 and p2 dicts and what is your expected result?

– naivepredictor
Mar 7 at 14:18





what are you trying to do with p1 and p2 dicts and what is your expected result?

– naivepredictor
Mar 7 at 14:18













my expected output is: ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'T'): (7, 3, 30, 4, 4)

– lilis gumilang
Mar 7 at 14:22





my expected output is: ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4), ('S', 'C', 'T'): (10, 12, 44, 5, 3), ('S', 'B', 'T'): (7, 3, 30, 4, 4)

– lilis gumilang
Mar 7 at 14:22













why SBT included and not SBDT?

– naivepredictor
Mar 7 at 14:31





why SBT included and not SBDT?

– naivepredictor
Mar 7 at 14:31













because SBDT is dominated by SBT. SBDT is pruned.

– lilis gumilang
Mar 7 at 14:32






because SBDT is dominated by SBT. SBDT is pruned.

– lilis gumilang
Mar 7 at 14:32














what do you mean by dominated? explain your logic how do you assume SBDT dominates SBT

– naivepredictor
Mar 7 at 14:35





what do you mean by dominated? explain your logic how do you assume SBDT dominates SBT

– naivepredictor
Mar 7 at 14:35












1 Answer
1






active

oldest

votes


















0















Question: compare value which dominance and not dominance




I have changed any(... to all(....



 for p2_key, p2_value in p2.items():
for p1_key, p1_value in p1.items():
d = [x < y for (x, y) in zip(p2_value, p1_value)]
print(''.format(d))

if all(d):
res.append(p2_key: p2_value)
else:
res.append(p1_key:p1_value)

print('dominance:'.format(res))



Output:



[True, True, True, True, False]
[True, True, True, False, False]
[True, True, True, True, True]
dominance:[('S', 'C', 'T'): (10, 12, 44, 5, 3),
('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4),
('S', 'B', 'T'): (7, 3, 30, 4, 4)]






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045757%2fhow-do-make-a-dominance-using-python-in-set%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0















    Question: compare value which dominance and not dominance




    I have changed any(... to all(....



     for p2_key, p2_value in p2.items():
    for p1_key, p1_value in p1.items():
    d = [x < y for (x, y) in zip(p2_value, p1_value)]
    print(''.format(d))

    if all(d):
    res.append(p2_key: p2_value)
    else:
    res.append(p1_key:p1_value)

    print('dominance:'.format(res))



    Output:



    [True, True, True, True, False]
    [True, True, True, False, False]
    [True, True, True, True, True]
    dominance:[('S', 'C', 'T'): (10, 12, 44, 5, 3),
    ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4),
    ('S', 'B', 'T'): (7, 3, 30, 4, 4)]






    share|improve this answer



























      0















      Question: compare value which dominance and not dominance




      I have changed any(... to all(....



       for p2_key, p2_value in p2.items():
      for p1_key, p1_value in p1.items():
      d = [x < y for (x, y) in zip(p2_value, p1_value)]
      print(''.format(d))

      if all(d):
      res.append(p2_key: p2_value)
      else:
      res.append(p1_key:p1_value)

      print('dominance:'.format(res))



      Output:



      [True, True, True, True, False]
      [True, True, True, False, False]
      [True, True, True, True, True]
      dominance:[('S', 'C', 'T'): (10, 12, 44, 5, 3),
      ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4),
      ('S', 'B', 'T'): (7, 3, 30, 4, 4)]






      share|improve this answer

























        0












        0








        0








        Question: compare value which dominance and not dominance




        I have changed any(... to all(....



         for p2_key, p2_value in p2.items():
        for p1_key, p1_value in p1.items():
        d = [x < y for (x, y) in zip(p2_value, p1_value)]
        print(''.format(d))

        if all(d):
        res.append(p2_key: p2_value)
        else:
        res.append(p1_key:p1_value)

        print('dominance:'.format(res))



        Output:



        [True, True, True, True, False]
        [True, True, True, False, False]
        [True, True, True, True, True]
        dominance:[('S', 'C', 'T'): (10, 12, 44, 5, 3),
        ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4),
        ('S', 'B', 'T'): (7, 3, 30, 4, 4)]






        share|improve this answer














        Question: compare value which dominance and not dominance




        I have changed any(... to all(....



         for p2_key, p2_value in p2.items():
        for p1_key, p1_value in p1.items():
        d = [x < y for (x, y) in zip(p2_value, p1_value)]
        print(''.format(d))

        if all(d):
        res.append(p2_key: p2_value)
        else:
        res.append(p1_key:p1_value)

        print('dominance:'.format(res))



        Output:



        [True, True, True, True, False]
        [True, True, True, False, False]
        [True, True, True, True, True]
        dominance:[('S', 'C', 'T'): (10, 12, 44, 5, 3),
        ('S', 'A', 'C', 'T'): (12, 14, 55, 1, 4),
        ('S', 'B', 'T'): (7, 3, 30, 4, 4)]







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 17:16









        stovflstovfl

        8,32341133




        8,32341133





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045757%2fhow-do-make-a-dominance-using-python-in-set%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко