Hi guys, thanks for any help offered.

I am attempting to ask a user for a height and width value - which need to be integers between 5 and 10 for each (height and width)

I also need the user to select 3 different colours, out of a predetermined list of colours.

My question is, which is cleaner:

Holding the height and width in their own variables - i.e.
width = #integer between 5 and 10
height = #same as above

With the colours being selected being held in their own variables:
colour1 = red
colour2 = blue
colour3 = yellow

Or would it be easier for the user to input the values and store them in a list
widthHeigh = [6, 7]

And the colours being held in a list:
userColours =

Please bare in mind that I need to access these individual variables later in the code.
If you could give me pointers in how best to code this segment, I would be very apreciative.

Many thanks,

5 Years
Discussion Span
Last Post by WolfShield

The general rule is that a list is always preferable to variables with numbered names, so don't hesitate and use a list.


I agree with Gribouillis.
If you have items that are similar it is much nicer to have them in a list or array. Easier to read and just as easy to access.

- WolfShield

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.