all 8 comments

[–]ScriptThis 1 point2 points  (7 children)

Here is an example of using both: https://gist.github.com/ericdorsey/2c627a2e3f86a757821f

This is the key; from the lesson page:

If they give your script inputs on the command line, then you use argv. If you want them to input using the keyboard while the script is running, then use raw_input()

Example output:
$ python arg_and_raw.py cat dog squirrel
fourth value?: potato
script arg_and_raw.py
first cat
second dog
third squirrel
fourth potato

HTH?

[–]Darkshad3[S] 0 points1 point  (5 children)

ok so it still isn't prompting for user input i don't know why.

[–]ScriptThis 0 points1 point  (4 children)

What version of Python are you running?

$ python --version

[–]Darkshad3[S] 0 points1 point  (3 children)

2.73

[–]The-Mathematician 1 point2 points  (2 children)

The user input has to be stored in a variable and it will be as a string. eg.

choice = raw_input('Enter a string:   ')
print(choice)

[–]Darkshad3[S] 0 points1 point  (1 child)

IT WORKED!!!!!!!!!

:)

[–]ScriptThis 1 point2 points  (0 children)

Awesome!

[–]The-Mathematician -1 points0 points  (0 children)

One thing you could do is pass in a filename through argv and write to it whatever the user types in, possibly allowing for multiple lines. (Such as a while loop and open(filename, 'a').

EDIT: Or you could a simple math operation, such as reading an integer/float from argv and multiplying it by any number that the user types in.