Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What do the brackets in 'turtle.pen()' do? What are they supposed to contain?

So recently I was planning to write a code using turtle graphics and I had a question. What do the brackets in t = turtle.Pen() mean? What are they supposed to contain? Please answer in a simplified manner as I am still a beginner at python 🙂

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Those aren’t brackets, they are parentheses. It’s a function call without arguments (or in this case, an object instantiation).

What they’re "supposed" to contain depends entirely on the function you’re calling (or object you’re instantiating).

For instance, print() accepts the arguments to print (or none to just print a new line):

>>> print()

>>> print("hello")
hello
>>> print("hello", 42)
hello 42
>>>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading