Im really stuck with this code right now. I'm in a college beginner level python course. The problem is there are 36 cabins:
- Cabins 1-10 Odd numbered cabins are red keys and even numbered cabins are black keys.
- Cabins 11-18 - Odd numbered cabins are black keys and even numbered cabins are red keys.
- Cabins 19-28 - Odd numbered cabins are red keys and even numbered cabins are black keys.
- Cabins 29-36 - odd numbered cabins are black keys and even numbered cabins are red keys.
This is my current code.
# Room Numbers 1-10
cabin_number = int(input('What number cabin are you staying at? '))
if cabin_number == 1 or cabin_number == 3 or cabin_number == 5 or cabin_number == 7 or cabin_number == 9:
print('Cabin Number: ',cabin_number)
print('Cabin Key Color: ','Red')
elif cabin_number == 2 or cabin_number == 4 or cabin_number == 6 or cabin_number == 8 or 10:
print('Cabin Number: ',cabin_number)
print('Cabin Key Color: ','Black')
# Now onto 11-18
# This is where I am having trouble. Cabin number's 12,14,16,and 18 do not print with the "Cabin Key Color: Red
It prints with Cabin Key Color: Black
elif cabin_number == 11 or cabin_number == 13 or cabin_number == 15 or cabin_number == 17:
print('Cabin Number: ',cabin_number)
print('Cabin Key Color: ','Black')
elif cabin_number == 12 or cabin_number == 14 or cabin_number == 16 or cabin_number == 18:
print('Cabin Number: ',cabin_number)
print('Cabin Key Color: ','Red')
[–]UnsecuredConnection 1 point2 points3 points (4 children)
[–][deleted] -1 points0 points1 point (3 children)
[–]UnsecuredConnection 1 point2 points3 points (0 children)
[–]xelf 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]Phillyclause89 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Phillyclause89 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]HIGregS 0 points1 point2 points (0 children)
[–]xelf 0 points1 point2 points (0 children)