Determine Number Fulfilling Three Inputs - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Determine Number Fulfilling Three Inputs (/thread-2385.html) |
Determine Number Fulfilling Three Inputs - kython - Mar-12-2017 So I have imported a csv list of superhero names, gender, eye color, hair color, and so on. I ask the user to input their gender, eye color, and hair color. After inputting each, they receive three messages. Example: Number of male characters: 11638 Number of characters with green eyes: 613 Number of characters with brown hair: 2339 How could I then take these three inputs and determine how many characters fulfill all three of the user inputs? RE: Determine Number Fulfilling Three Inputs - Larz60+ - Mar-13-2017 Please show your code to this point Assuming that the text is in a string, it's simply len(Myvariablename) then add together RE: Determine Number Fulfilling Three Inputs - merlem - Mar-13-2017 (Mar-13-2017, 02:33 AM)Larz60+ Wrote: then add together Wouldn't that give the result for how many characters fullfill any of the conditions? Or did I misunderstood? Assuming that the three already given responses are done by a check, it should be possible to do the check 'in a row' by combining if with and :if ... and if ... and if ...: add_to_number_of_characters_fullfilling_all_conditions RE: Determine Number Fulfilling Three Inputs - Larz60+ - Mar-13-2017 Quote:How could I then take these three inputs and determine how many characters fulfill all three of the user inputs? How else to get sum of all 3? |