Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2015
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    another python assignment help needed

    Assignment
    1
    7
    Download this Python program
    ,
    and
    download and extract
    this
    zipped
    data file
    :
    http://burtondsc.pbworks.com/w/file/...ingaverage.zip
    http://burtondsc.pbworks.com/w/file/...tingaverage.py
    The
    battingaverage.txt
    file’s data is organized into pairs of records as follows:
    Line 1: The batter
    position
    , values 1
    -
    9
    Line 2: A value indicating an out (0) or a hit (1)
    So, the first 6 lines of the file are as follows:
    4
    1
    7
    1
    9
    0
    This indicates that player
    at position
    4 hit the ball, player 7 hit the ball, and player 9 struck out.
    There are only 9 po
    sitions on a team, so only values 1
    -
    9.
    The file is terminated with a pair of
    -
    1 values.
    Th
    e
    program is
    supposed to
    output the batting average for each of 9 players’ positions using
    the data file supplied. A batting average is how many times the batter hit
    the ball vs. how many
    times he attempted to hit the ball, or ‘at bat.’
    Here is
    what the program
    should
    output using the
    file supplied
    :
    212 pairs of data read.
    The batting average for:
    position 1 is 0.3469387755102041
    position 2 is 0.24074074074074073
    position 3 is 0.27450980392156865
    position 4 is 0.2682926829268293
    position 5 is 0.23404255319148937
    position 6 is 0.2222222222222222
    position 7 is 0.3220338983050847
    position 8 is 0.30434782608695654
    position 9 is 0.21951219512195122
    Unfortunately,
    this program has lots of errors.
    It is your task to fix this program and submit it
    .
    You
    should end up with the same output as above
    when
    you use the included data file
    .
    Assume
    the data file is in the same folder as the python program.
    Fix the program. Save
    the
    Python
    file and submit it to the
    appropriate
    drop box.
    You do not
    need to submit the original, incorrect program
    , nor the data file
    .

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,873
    Thanks
    6
    Thanked 1,299 Times in 1,269 Posts
    We’re not here to do your homework. Read the rules, specifically rule 1.5; you’re not learning anything if someone else is doing your work. Show us some of your own effort and then ask specific questions rather than just copy-pasting your assignment here. Where I come from that’s called cheating.

  3. Users who have thanked VIPStephan for this post:

    lazorus (12-01-2016)


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •