Python · Functions, Methods & Attributes

A method's signature is shown as method(p1, [p2, p3]). What do the square brackets mean?

Answer locked. Get the free KnowCard app to reveal it — plus spaced-repetition review so it actually sticks.

Get it on App StoreGet it on Google Play

This is one card from the KnowCard library — thousands more across SAP, Linux, Python and more. In the app you get the answer, AI explanations, and cards that come back right before you would forget them. Free to start on iOS, Android or the web.

More in Functions, Methods & Attributes

What does this print? ``` def diff(a, b): return a - b print(diff(2, 10)) ```
What is the difference between a function and a method in Python?
You want to sort a list. Why does sort(mylist) fail, and what is correct?
What does this print? ``` def greet(): return "hi" print(greet) ```
Calling diff(a, b), how can you make the call order-independent and self-documenting?
What does number.real.is_integer() do, reading it left to right?

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play