Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Classes
#6
(Feb-15-2019, 10:06 AM)Lonewolf Wrote: i don't think i need a grid class since teacher told us not to use one and the set of coordinates should be saved in each class.

Yes, you can skip the Grid class, although normally you would use it. If teacher explicitly tells you not to use one, then don't

(Feb-15-2019, 10:06 AM)Lonewolf Wrote: i know that triangle and sphere inherit from Shape but i dont know how to write it.it's conusing.

Fix your classes, before you do the random/grid part. For the inheritance part - take a look at this https://www.pythonforbeginners.com/super...r-function

One problem with your code as it is now - you need to pass all the necessary information when instantiate triangle or sphere (i.e. instance of the class). I mean all the information - that is, not only width, height, length or radius, but also x, y, and penalty, but also the information for the parent class - x, y and penalty. Then you will use x, y, and penalty to initialize the parent class.

(Feb-15-2019, 10:06 AM)Lonewolf Wrote: teacher told ud to make it easier to fill it with objects of the characteristics example all triangles same height,width,lenght etc
That means you can define default values for these properties.
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

Reply


Messages In This Thread
Help with Classes - by Lonewolf - Feb-14-2019, 05:13 PM
RE: Help with Classes - by woooee - Feb-14-2019, 08:06 PM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 08:05 AM
RE: Help with Classes - by buran - Feb-15-2019, 09:44 AM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 10:06 AM
RE: Help with Classes - by buran - Feb-15-2019, 10:39 AM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 11:07 AM
RE: Help with Classes - by buran - Feb-15-2019, 11:32 AM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 04:55 PM
RE: Help with Classes - by buran - Feb-15-2019, 07:38 PM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 09:17 PM
RE: Help with Classes - by buran - Feb-15-2019, 09:34 PM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 08:09 AM
RE: Help with Classes - by buran - Feb-16-2019, 08:18 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 08:22 AM
RE: Help with Classes - by buran - Feb-16-2019, 08:22 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 08:55 AM
RE: Help with Classes - by buran - Feb-16-2019, 08:25 AM
RE: Help with Classes - by buran - Feb-16-2019, 09:02 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 09:17 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 10:52 AM
RE: Help with Classes - by buran - Feb-16-2019, 11:25 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 11:29 AM
RE: Help with Classes - by buran - Feb-16-2019, 11:46 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 11:50 AM
RE: Help with Classes - by Lonewolf - Feb-17-2019, 03:17 PM
RE: Help with Classes - by Lonewolf - Feb-17-2019, 06:48 PM
RE: Help with Classes - by Lonewolf - Feb-18-2019, 08:07 AM
RE: Help with Classes - by Lonewolf - Feb-18-2019, 05:35 PM
RE: Help with Classes - by sonedap - Feb-18-2019, 08:44 PM
RE: Help with Classes - by sonedap - Feb-19-2019, 06:56 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020