0

In the python lessons when it teaches object oriented and making objects the results come out as words and numbers?

Python

11th Mar 2020, 3:28 PM
Tyler Eavey
Tyler Eavey - avatar
6 Réponses
0
Do you mean that creating objects results in numbers and words? When you create an object this object belongs to a class that you maybe have defined on your own. If you create an object of that class its not a number or word, its an instance of that class with the attributes and methods defined in that class. Of couse you can add a number attribute in that class definition and access this number of that object over the attribute but the object itself is not the number.
11th Mar 2020, 3:35 PM
Jnn
Jnn - avatar
0
Maybe I really have no idea. I just know the code isn't making objects. Like I used a function to make a square and the results were 25. Not a square.
11th Mar 2020, 3:57 PM
Tyler Eavey
Tyler Eavey - avatar
0
Can you post your code here?
11th Mar 2020, 4:40 PM
Jnn
Jnn - avatar
0
I posted but it didn't post here but took a picture of it off my computer.
11th Mar 2020, 4:48 PM
Tyler Eavey
Tyler Eavey - avatar
0
I think you should create an rectangle object in your classmethod
11th Mar 2020, 5:33 PM
Jnn
Jnn - avatar
0
Ok I will try it and send you the results. Thank you.
11th Mar 2020, 5:35 PM
Tyler Eavey
Tyler Eavey - avatar