Oct-14-2018, 04:29 AM
Not sure. I am new to python and at a loss.
Creating a script with a class have specific properties
|
Oct-14-2018, 04:29 AM
Not sure. I am new to python and at a loss.
Oct-14-2018, 06:47 AM
(Oct-14-2018, 04:26 AM)CxxJxxYxx Wrote: May I ask why the 'tree' in 'print(tree.report(1))' isn't capitalized? I am confused about this point. Because in previous sentences nothing is defined as 'tree', but only the class 'Tree' I think this is about my example. Tree is the class. tree is just a variable name, i.e. it could be whatever you want. So tree is an instance of class Tree . It's created on line #18. You are not correct there is nothing defined as tree. From my example:#example how to instanciate object of class Tree #ignore numbers if they don't make business sense tree = Tree(block=1, plot=5, species=7, dhb=200) print(tree.report(1))Once again - tree is just variable, instance of Tree. You may have many instances of a class in your code.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
@dvldgs05, did you check the tutorials I shared in a previous post? It seems you still lack basic understanding of working with classes. You need to understanding the basics in order to understand what is offered as help and use it the way you want
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Oct-15-2018, 08:54 PM
I will check them again. It is just not clicking for me at this time.
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
I need help writing this code for string properties and methods | hannah71605 | 4 | 4,081 |
Mar-22-2021, 12:36 PM Last Post: menator01 |
|
Creating Email Message Class in Python | QuavoJ | 1 | 3,121 |
Jul-20-2020, 08:30 PM Last Post: Yoriz |
|
Sort objects by protected properties. | Sigriddenfeta | 1 | 2,520 |
Mar-17-2020, 04:11 AM Last Post: Larz60+ |
|
Creating class with getters and setters. | amandacstr | 3 | 3,166 |
Jun-19-2019, 07:10 PM Last Post: nilamo |
|
newbie questions about objects properties... | slowbullet | 2 | 3,388 |
Aug-12-2018, 01:12 PM Last Post: Gribouillis |