Python Forum
Determining the Percentage of Voter Population
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Determining the Percentage of Voter Population
#5
The class should just do this: store the information given for one county, and calculate that county's voter percentage.

Then you create an instance of the class for each county, which will automatically get the voter percentages. Then you can use that information to find the largest voting percentage. If you've studied overriding special methods like __lt__ and __eq__, you can use those so that class instances sort themselves by voting percentage. Otherwise, you could do a sort with a key parameter to sort by the instances' voter percentage attribute.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: Determining the Percentage of Voter Population - by ichabod801 - Dec-28-2019, 11:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Linked List - Ordering by largest population with country name. PaleHorse 2 3,097 Jun-16-2020, 09:04 PM
Last Post: jefsummers
  finding percentage in a list. samh625 3 5,778 Jun-15-2020, 06:49 PM
Last Post: samh625
  Numerically determining the highest a ball travels when shot straight up JakeWitten 3 3,547 Apr-22-2017, 04:37 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

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