Python Forum
Determine Number Fulfilling Three Inputs
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Determine Number Fulfilling Three Inputs
#1
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?
Reply
#2
Please show your code to this point

Assuming that the text is in a string, it's simply len(Myvariablename)
then add together
Reply
#3
(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
Reply
#4
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Determine if string is integer jrodencal 12 4,089 Oct-15-2019, 01:39 PM
Last Post: jefsummers
  Determine if a list contains a specific number of an item flannel_man 3 4,880 Nov-12-2016, 04:46 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020