#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0

    *ITEM COUNTER* help


    Assume that a file containing a series of integers is named numbers.txt and exists on the
    computer’s disk. Write a program that calculates the average of all the numbers stored in
    the file.
  2. #2
  3. Commie Mutant Traitor
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Location
    Alpharetta, GA
    Posts
    1,806
    Rep Power
    1570
    Can you post what you have on this so far? Do you have any specific questions we might be able to answer?
    Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
    #define KINSEY (rand() % 7) λ Scheme is the Red Pill
    Scheme in ShortUnderstanding the C/C++ Preprocessor
    Taming PythonA Highly Opinionated Review of Programming Languages for the Novice, v1.1

    FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by Schol-R-LEA
    Can you post what you have on this so far? Do you have any specific questions we might be able to answer?
    This is what i have so far. I have a text file with some 6 random names in it. I'm not sure where to go from here to get the program to display the number of names.

    def main():
    # Open the names.txt file.
    in_file = open('names.txt', 'r')

    # Read the first line from the file, which is
    # the name field of the first record.
    name = in_file.readline()
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by Schol-R-LEA
    Can you post what you have on this so far? Do you have any specific questions we might be able to answer?
    This is what i have so far. I have a text file with some 6 random names in it. I'm not sure where to go from here to get the program to display the number of names.

    def main():
    # Open the names.txt file.
    in_file = open('names.txt', 'r')

    # Read the first line from the file, which is
    # the name field of the first record.
    name = in_file.readline()
  8. #5
  9. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,889
    Rep Power
    481
    jwhit1984: Please have an educated, intelligent, sane, sober friend read your posts in this thread and have this friend then explain to the irrationality of it all.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo