Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you're looking for is a tuple: <code>self.Attribute1 = (randint(w,x), randint(y,z))</code> where w, x, y, and z are whatever constants you want. Then, you can compare them by accessing each column individually: <code>Attribute1[0]</code> and <code>Attribute1[1]</code>.</p> <p>Here's an idea: let's try to take your first program concept and make it a little more object-oriented. While the program you describe works, I think you're more interested in practicing inter-class relationships -- correct me if I'm wrong here. How about creating two classes: <code>RandomObjectA</code> and <code>RandomObjectB</code>. In both of these classes, define a set of variables, and then compare them within your main method. This will really help you understand how programming works on an object level, which is a much more important lesson than specific data constructs.</p> <p>Once you've done that successfully, I would add some methods to each of your classes; how can you make it such that classes don't directly interact with attributes in other classes?</p> <p>After that, I'd look into inheritance. What if we wanted to create 100 classes called <code>RandomObjectX</code>? It obviously wouldn't be reasonable to hand-code each and every last one, so let's think about how we can derive functionality from a higher-up class, called a superclass.</p> <p>Lastly, while I appreciate that you're jumping in and trying things, I highly recommend that you read the Python tutorial and documentation. It's honestly not a hard read, you'll learn a ton, and you'll have a better scope of what exactly is going on when you code. If you combine hands-on practice and personal projects with reading documents, coding becomes much easier. Good luck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload