Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8432223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:04:16+00:00 2026-06-10T06:04:16+00:00

Zed Shaw’s Learn Python the Hard Way frequently asks you to write out in

  • 0

Zed Shaw’s “Learn Python the Hard Way” frequently asks you to “write out in English” what each and every line of a script does. I am struggling to do that with some stuff associated with the function (command?) argv because I don’t know what to name certain parts of the code. Heck, I don’t even know what to call argv–a function? A command? Variable? I know it’s a module. But back on track:

Here is the code from exercise 13:

from sys import argv

script, first, second, third = argv

print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third

Zed states “The ‘argv’ is the “argument variable.” My question is, what is the name of the things to the left of the equals sign on line three?

Colloquially speaking, my urge is to call the words “script,” “first” etc. variables themselves–but that doesn’t seem right, since according to Zed argv is “the argument variable.”

I did not think calling them “arguments” is correct either; I’ve only read “argument” in terms of command line arguments.

“Parameters” seemed likely, since it was mentioned in the title of the exercise, but doing web searches with combinations of “equals sign,” “=,” “python,” “argv,” “definition” and so on wasn’t very enlightening. Searching for things is very difficult when you don’t know what they’re called.

I am very clear on what’s happening in this script, I’m just not clear on the name of a part of it. I am very sure I’m going to slap my forehead when this is answered.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:04:18+00:00Added an answer on June 10, 2026 at 6:04 am

    The things to the left of the "=" are variables that get their value from the variable on the right.

    Given:

    script, first, second, third = argv
    

    argv is a list of strings which in this case contains 4 items. These strings are “unpacked” and assigned to the four variables on the left of the =.

    argv gets its value is when a Python program is invoked from the command line, like this:

    test.py this is sure cool
    

    in this case argv will contain ['test.py', 'this', 'is', 'sure', 'cool']. These strings after the command are called “command line arguments” (see this tutorial) and the name of the script, and any arguments are stored in argv. This is a way to send information to the script when you start it.

    In this case the variables get the following values:

      script is set to  "this.py"  # the string is in argv[0]
      first to "is"     # argv[1]
      second to "sure"  # argv[2]
    

    and

      third to "cool"   # argv[3]
    

    So:

      script, first, second, third = argv
    

    is really equivalent to:

      script = argv[0]
      first = argv[1]
      second = argv[2]
      third = argv[3]
    

    It’s only that Python lets you do this assignment in one nice swoop.

    Note that you can pull out your command line arguments in any order using the appropriate index value.

    This mechanism is used to communicate information the to the Python script. You can imagine running a program that expects an input file and and output file. Instead of hardcoding them in your script, you could provide them on the command line. E.g.,

     computeData.py input.txt result.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on Learn Python the Hard Way by Zed Shaw. I
Hey guys, I'm currently completing Zed Shaw's Learn Python the Hard Way and I've
I am close to completing Zed Shaw's Learn Python The Hard Way. I also
I'm reading Zed Shaw's Learn Python The Hard Way. I'm up to exercise 17
I'm working my way through Zed Shaw's Learn Python The Hard Way. I'm up
I'm doing Zed Shaw's fantastic Learn Python The Hard Way , but an extra
i'm reading zed shaw's book learning python the hard way. Forgive me but i'm
I'm trying to follow Zed Shaw 's guide Learning Python the Hard Way .
I am working through Zed Shaw's Learn C the Hard Way. In the chapter
I'm doing Zed Shaw's Learn C The Hard Way course. On exercise 11, in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.