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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Tsering Choedhen](https://secure.gravatar.com/avatar/68c38d37698b88d48d04f2dffefb58dd?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Tsering Choedhen
1,051 PointsWhy one arguments is within quotes ("Books") and another one is not when display_list function is called?
When display_list function was defined, it was set with two parameters. And now when this function is called, the two arguments passed. But one argument is passed in a quotes (" ") and another one is not. Why and how will we know that when the arguments passed should be in quotes or not?
3 Answers
![boi](https://uploads.teamtreehouse.com/production/profile-photos/10720541/micro_Kratos.jpg)
boi
14,242 PointsAll problems are best understood with practical examples, so let's make an example code.
The code
Books = ["Harry Potter and the philosophical stone", "Harry Potter and the dungeon of secrets", "Harry Potter and the prisoner of Azerbaijan"]
#Let's make a function now
def display_list(display_name_of_book_series, the_list_of_books):
print(display_name_of_book_series)
print(the_list_of_books)
#Now let's call the function
display_list("Harry Potter", Books)
The points to take from the example are that
1) The double quotes ("") are used to make a string and anything inside the double quotes ("") will be a string.
2) If anything is a string, it will be taken as it is like, literally, for example, if I put (aposkfj3474734''';;;>><<<<mn(sjsjd) [ a, b ,c,c,v,(polo)] into a string it will be as it is, a practical example;
A_string = " (aposkfj3474734';;;>><<<<mn(sjsjd) [ a, b ,c,c,v,(polo)] "
print(A_string)
#Output (aposkfj3474734';;;>><<<<mn(sjsjd) [ a, b ,c,c,v,(polo)]
So anything inside double quotes("") is untouchable. Strings are like a Black Hole it absorbs everything and anything, what if you want to put double quotes ("") in a string, the principle is very simple just put the double quotes("") into triple quotes (""") and you got a string.
example of string;
A_string = ( """The name of the book is 'Harry Potter' and the name of the character is "Harry" is noob""" )
print(A_string)
3) A variable is a name you give or assign to an object ( an object can be anything, it can be a string, a list, a tuple, a number, a function .....) in this case Books
is a variable or name assigned to a list of book names. Variables need to be assigned to something otherwise they won't work.
an example
#variable # A string
Books = "Books"
4) The display_list function takes two parameters and then prints out whatever is passed in, in this case, I passed in "Harry Potter" as a string and Books as a variable
SO in a summary, regarding your question, the "Books"
is just a string and it can be anything you want it to be you can call it "123455"
and it won't make a difference because it's a string the Books
without the double quotes ""
is a Variable and has a value stored in it, so if you put in Book list
the program won't be able to find the name Book list
because the Variable Book list
does not exist.
![Ave Nurme](https://uploads.teamtreehouse.com/production/profile-photos/11536717/micro_Pic_1.jpg)
Ave Nurme
20,907 PointsHi Tsering
In here...
def display_wishlist(display_name, wishes):
-
display_name
is just a string, in this case it is"Books"
- that's why we put this in quotes -
wishes
is the list which is passed in, in this case it isbooks
on line 1
Does this help?
![Tsering Choedhen](https://secure.gravatar.com/avatar/68c38d37698b88d48d04f2dffefb58dd?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Tsering Choedhen
1,051 PointsThank you Ave Nurme and boi for your explanations.