Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
230,178 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.