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 trialCristian Yanez
491 PointsClasses, object, methods?
What exactly is a class, an object, a method and def? Also what is arguments or parameters. I know the definition of these, but can someone show me them in code?
def my_function_name(): <--- Is this considered an object?
Print("this is the functions body") <------- is this considered a method?
What is print? An object method or class? Once again, I know the definition what can someone show me them in code so I can see them in action?
Also what do you mean when you say "not all values are variables"?
1 Answer
Alexander Davison
65,469 PointsBe patient... I know the beginning of this course can get really confusing, but I know you are smart and eventually you'll understand
-
print
Is a built-in Python function that prints a value of any type onto the screen. - A type is like the kind of value like for example the text "Hello world" is type of String, and 3 is type Int (short for integer)
- In Python, you can even (basically) create your own types, and these are called
classes
. - In Python,
def
is short for "define". You use this key word to tell Python "Over here, I'm going to create my very own function". - In Python,
parameter
s andargument
s are the values you pass in to a function. The meaning are slightly different... - Arguments are the actual values passed in. Parameters are the name of the argument you use in the function definition.
Again, don't worry too much about this, you will see these all come together in close future
Got more questions I didn't catch? Feel free to ask below. :)
I hope this helps. ~Alex