Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Konrad Gołda735 Points
Arguments vs. Strings
can anyone explain what is the difference between arguments and strings?
In previous video, Craig pointed that argument is everything in between parenthesis, and strings are inside of the quotation marks.
Here in this Video, when he is explaining that we can print a statement constructed from few strings inside of parenthesis ("string", "string2", "string3"). With the knowledge from previous video I would say, that we can use multiple strings inside of one argument, but he is using the therms "string" and "argument" interchangeably like one was the synonym for the another.
Can anyone explain how it is in fact? Also, why Craig actually says so and is it his manner that will interrupt me learning from this course in the future videos? Feeling quite confused - not everything is explained as for a newbie. Let me express, that for you guys who have programming in a little finger those things might have no importance, but for new learners it is a really hard brain teaser.
Chris FreemanTreehouse Moderator 68,154 Points
- a function is defined with one or more parameters
- a function is called by providing arguments
- during execution, the function parameters are assigned to the arguments provided in the calling statement
# Given a function, def some_func(param1, param2, param3): print(param1) print(param2) print(param3) # called with three arguments: some_func("string1", "string2", "string3")
In this case, each of the three strings is an argument of the function call.
- param1 is assigned to "string1"
- param2 is assigned to "string2"
- param3 i assigned to "string3"
The arguments do not have to be strings. Depending on the code within the function, each parameter may be expecting an argument of a certain type.
Post back if you need more help! Good Luck!
Konrad Gołda735 Points
Thank you guys for replying. Thanks Chris for explaining.
Kris, the video I was talking about is a video "Syntax and Errors" under this link: https://teamtreehouse.com/library/syntax-and-errors somewhere arount 4th minute.