Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

reference: I don't know how to provide them in text format. candidates.py In text: import sys import copy import os.path if len(sys.argv) != 2:

imageimageimageimage

reference: I don't know how to provide them in text format.

candidates.py

image  

In text:

import sys
import copy
import os.path

if len(sys.argv) != 2:
    print("You must specify the candidates file name")
else:
    filename = sys.argv[1]
    if not os.path.isfile(filename):
        print("The file {} is not existed".format(filename))
    else:
        in_stream = open(filename, 'r')
        lines = in_stream.readlines()

        # FILL UP YOUR CODE BELOW THIS LINE
        # ...
        # ...
        # ...
        # FILL UP YOUR CODE ABOVE THIS LINE

 

votes_00.txt

image  

In text:

2
Aamir Carver
Spencer Sparks
MA 7 65494 101827
VA 4 424941 909315
PA 8 1179896 564695
OK 6 420691 758458
NY 4 2468648 2533608

 

votes_01.txt

image  

In text:

2
Om Russell
Adelaide Rivas
SC 6 49961 23181
IA 7 224913 126201
MI 3 99610 40164
WA 18 574641 81788
MN 3 1401803 291623

 

votes_02.txt

image  

In text:

3
Maheen Holt
Jasmine Maynard
Eliott Dillon
WY 15 274100 2329538 2463213
IN 13 805357 2177146 2828078
MD 55 118019 31755 5925
SD 9 106298 34336 92889
NV 18 310786 172168 79517

 

votes_03.txt

image  

In text:

3
Ahyan Hodson
Arwel Prentice
Suzanne Laing
NE 6 1092125 1512377 968722
AR 4 504228 834906 444967
TN 7 89953 18583 5897
WY 3 874723 800728 641457
WI 6 232929 355236 11591
ME 3 293382 449035 163063
OK 4 80518 1391386 772255
IN 20 53757 3309 67108
VA 8 181313 330295 504509
NV 3 44510 61664 185436

 

votes_04.txt

image  

In text:

3
Esmae Archer
Nikola Weaver
Anna-Marie Santos
NM 3 387104 872436 484968
NJ 18 284351 161970 256745
ND 55 60181 53611 105833
IL 7 623495 997143 916029
NE 36 1342415 1650175 1647325
FL 3 30067 12200 66725
TN 4 576565 85172 39087
NY 16 1314552 1393248 655590
OK 20 194585 279190 277791
KS 3 308978 29744 477218
WY 16 51515 22261 16487
AL 9 1872168 2818852 683744
UT 10 10715 56790 55660
MO 13 360843 123914 214010
AZ 8 183465 534838 80115
GA 10 5302 102841 203762
ID 6 665921 573367 1206408
OR 7 82646 19026 25118
MI 11 180871 848629 830310
NC 6 53241 228378 32173
WA 10 22924 32478 6571
DC 7 194899 128438 302398
IN 3 280252 105343 356630
HI 5 140840 346913 356043
LA 14 198122 238245 874314
WV 3 7533 95000 24813
MD 3 493304 128594 235386
RI 5 66163 64642 571401
CT 4 600549 254156 207214
AK 5 81442 111501 39240
CA 3 804025 151717 690236
MS 8 101182 132653 51773
AR 11 753456 302464 857678
CO 29 3319626 1237623 2795496
NV 20 162550 344402 353303
SD 3 1655879 959383 1291842
ME 6 469009 191818 204777
VA 9 143237 1073699 1188439
KY 11 382042 748285 1301465
MT 9 623805 1035121 913262
OH 29 178661 178436 7472
VT 3 64722 108489 169201
SC 6 56782 4579 40458
PA 3 911348 893260 687
MA 6 904149 655360 402077
WI 10 59039 60480 35474
DE 8 485596 315829 33107
TX 11 187824 219811 86186
MN 4 32834 33206 263877
IA 15 399501 310137 262311
NH 6 97153 461877 950275

 

votes_05.txt

 

image

In text:

3
Dotty Mejia
Tanya Fitzpatrick
Arron Fleming
HI 36 1934 62075 3050
MN 10 878949 210456 386637
NY 8 58605 121761 27173
TX 7 60040 1668362 1750325
IA 3 68925 378107 269901
CO 20 1588904 2513456 49471
NV 5 540477 386559 108501
UT 8 32020 114400 91422
OH 16 63061 222089 151421
MS 3 605936 1366101 639200
WI 6 242578 70797 47930
ND 5 991928 713276 1065248
AZ 55 83582 282611 329078
OR 3 117068 203726 238541
LA 9 65066 136310 222758
WY 15 351 150389 2391
SD 3 89399 101542 327022
NM 11 90268 517251 453805
MO 5 708772 62785 139719
FL 3 37335 122396 28916
KS 6 663289 866044 362565
AK 6 581995 62562 23164
ME 9 90486 330527 120913
NJ 16 366323 383500 730965
SC 11 62471 438950 47948
MA 7 519430 572554 448320
GA 29 216776 267181 391354
VA 8 399114 130088 185130
CA 20 109129 379694 176299
OK 3 1244023 1781812 1541493
WV 11 51517 120 55645
PA 3 1550168 1797451 1993867
DC 18 238417 267052 242745
MI 13 39760 1428548 1483055
DE 6 84165 207339 75507
AR 4 88229 68589 99615
KY 10 514509 610845 657829
RI 7 366740 102737 288931
AL 10 63037 55182 20025
NC 11 375532 315812 217032
IL 9 39893 58746 93442
MD 29 150560 338256 105281
VT 3 333052 131802 533067
MT 3 940813 987072 696721
WA 6 2075514 2365505 1972806
NE 3 111455 327361 317822
ID 10 862134 931066 299564
TN 6 188204 175536 56271
NH 4 75873 85047 4796
IN 4 761335 28040 894359
CT 14 47501 500807 362756


Assignment #3 - Voting and Elections Background: One of the most important rights of American citizens is the franchise the right to vote. Originally under the Constitution, only white male citizens over the age of 21 were eligible to vote. This shameful injustice has been corrected and voting rights have been extended several times over the course of our history. All States, except for Maine and Nebraska have a winner-take-all policy where the State looks only at the overall winner of the state-wide popular vote. Maine and Nebraska, however, appoint individual electors based on the winner of the popular vote for each Congressional district and then 2 electors based on the winner of the overall state-wide popular vote. Objectives: Electoral votes are allocated among the States based on the Census. Every State is allocated a number of votes equal to the number of senators and representatives in its U.S. Congressional delegation two votes for its senators in the U.S. Senate plus a number of votes equal to the number of its Congressional districts. This assignment will assess your mastery of the following objectives: Write conditionals, loops, variables, and console output. Read structural data in file Use list to store information and produce the processing data. Follow prescribed conventions for spacing, indentation, naming methods, and header comments.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistics For Management And Economics

Authors: Gerald Keller

11th Edition

978-1337296946, 1337296945, 1337093459, 978-1337516723, 1337516724, 978-1337093453

More Books

Students also viewed these Programming questions

Question

What type checking is done in Smalltalk? When does it take place?

Answered: 1 week ago