Dec-28-2019, 11:30 PM
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.
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
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures