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

    Join Date
    Sep 2007
    Posts
    16
    Rep Power
    0

    Using 'input' to populate a list


    Is there a way to populate a list using either the 'input' or 'raw_input'? What I am trying to do is take a user input and add to a list so that it can be used in a program to give the average of the numbers given by the user.

    Thanks in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    /usr/bin/ruby
    Posts
    63
    Rep Power
    29
    You could either split raw input and take each word into a list, or maybe something like

    Code:
    import sys
    sys.stdin.readlines()
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2007
    Posts
    16
    Rep Power
    0
    Thanks for the info, but i am very new to programming, less than one month and I am unfamiliar with import sys, sys.stdin.readlines() statements. I will look them up using the help() function though. Once again thanks!!

IMN logo majestic logo threadwatch logo seochat tools logo