I have a list of film titles and time from my class attributes. I have displayed this list with:
for i in range(0, len(films)):
print(i, films[i].title, films[i].time)
This gives me a list of the titles in number and time.
Now I want to get at any item in title so that I could make calculation on based on the choice with number of seats.
I tried this:
i = int(input("Please select from our listings :"))
while i <= films[i].title:
i = input("Please select from our listings :")
if i in films[i].title:
print("You have selected film: ",films[i].title)
print("Regular seat: ", choice[regular], "\nVip Seat: ", choice[vip], "\nDiamond Seat: ", choice[diamond], "\nPlatinum Seat: ", choice[platinum], "\nDisability Regular Seat: ", disabilityRegular, "\nDisability Vip Seat: ", disabilityVip, "\nDisability Diamond Seat", disabilityDiamond, "\nDisability Platinum Seat", disabilityPlatinum )
seatType = input("\nSelect your seat from these list: ")
seating = int(input("How many seats: "))
if seating == items in choice:
total = seating*altogether[seatType]
print(total)
when run it displays this:(Note the list starts from 0):
29 End of Watch 20:00
30 Gremlins 19:30
31 The Twilight Saga: Breaking Dawn part 2 20:00
Please select from our listings :6
Please select from our listings :4
Traceback (most recent call last):
File "C:/Python32/cin.py", line 91, in <module>
if i in films[i].title:
TypeError: 'in <string>' requires string as left operand, not int