I do not want to sound demanding or anything so I just want to ask you a huge favor, I try to make a program that has 20 rooms (they are all those s1
, s2
etc with true
) tell me if they are busy or no, if ' 'numero de habitación''==True
is free if false
is occupied , but when trying to execute the code the message appears, 'bool' object is not subscriptable
, I'm just learning to use python.
s1=True
s2=True
s3=True
s4=True
s5=True
s6=True
s7=True
s8=True
f1=True
f2=True
f3=True
f4=True
f5=True
f6=True
f7=True
f8=True
p1=True
p2=True
p3=True
p4=True
class reservas:
def __init__(self):
self.Hs={s1,s2,s3,s4,s5,s6,s7,s8}
self.Hf={f1,f2,f3,f4,f5,f6,f7,f8}
self.Hp={p1,p2,p3,p4}
def Estado(self):
print("ingrese el tipo de habitacion")
print("1) Sencilla")
print("2) Familiar")
print("3) Premium")
self.x=int(input("------>"))
if self.x==1:
for i in self.Hs:
c=0
if i[c]==True:
self.a="Disponible"
else:
self.a="Ocupada"
print("La habitacion"+str(c),"esta",self.a)
c=c+1
elif self.x==2:
for i in self.Hs:
c=0
if i[c]==True:
self.a="Disponible"
else:
self.a="Ocupada"
print("La habitacion"+str(c),"esta",self.a)
c=c+1
elif self.x==3:
for i in self.Hs:
c=0
if i[c]==True:
self.a="Disponible"
else:
self.a="Ocupada"
print("La habitacion"+str(c),"esta",self.a)
c=c+1
elif self.x>3:
print("Ingrese un valor correcto")
a=reservas()
a.Estado()