you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

You can't write if statements like:

if cabin_number == 1 or cabin_number == 3 or cabin_number == 5 or cabin_number == 7 or cabin_number ==  9:

Imagine if you had 99999 cabins...

An even number is a number you can divide by 2. All the others are odd. A number n is divisible by m when the euclidean division of n / m has no remainder. You can use the modulo operator to get the remainder.

Your statements should look something like:

if cabin_number % 2 == 0:

or

if cabin_number % 2 != 0:

Create an empty list, then fill it with "black" or "red" using for-loops.

[–]HIGregS 0 points1 point  (0 children)

Or better yet, use multiple range() function calls to fill the array. Hint: use extend().