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.

Python Python Basics Meet Python Variables

mohan Abdul
PLUS
mohan Abdul
Courses Plus Student 1,453 Points

so when the teacher changed the variable to 11 why did he not need to add quotation marks?

Also I am not really understanding what ellipises are exactly, and struggling to grasp the concept of arguments? could someone break it down in laymans terms please.

3 Answers

Steven Parker
Steven Parker
210,423 Points

Quotes are only used around literal string values. For a numeric value (like 11), quotes are not used.

Ellipses in a definition are a "rest" operator, the name following them becomes an array filled with the "rest of" the arguments given. But in a call, ellipses are the "spread" operator and convert the array following them into individual arguments. For more details, see the MDN pages on Rest parameters and Spread syntax..

Quotation mark is not required for numeric value. However, you can add quotation to a numeric values to turn them into string values. For instance : string = ' 11 ' and string = 11 are completely different, both are acceptable but one is numeric value and one is literal string value.

For your second question, think of argument as an input. Method such as print in Python requires at least one argument (input) to perform a function such as printing text to the screen. Hope that answers your question.

That caught me by surprise. By typing 11 instead of "11" he changed the variable type from a string literal to an integer. To keep the lesson consisent it definitely should have been "11" as 11 without the quotes behaves in a completely different way. Doesn't matter for this lesson but makes a huge difference down the road.