我試着下面的代碼爲正常的示例問題,但我的程序不會進入'如果'條件?我不能去'如果'的條件
bus_list=[1,2,3,4,5,6,7,8]
seat_list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
bus_num= input("enter the bus number\n")
print(bus_num)
if bus_num in bus_list:
print("available seats are \n" +seat_list)
seat_take=input("enter you seat number\n")
if seat_take in seat_list:
print("seat available")
else:
print("sorry! seat taken")
else:
print("bus doesn't exists")
「爲什麼我不能找到一個完整的整數列表一個字符串?」 – vaultah 2014-10-04 17:01:41
Python 2或Python 3?在Python 3中,你將有一個* string *值'bus_num',而不是一個整數。 – 2014-10-04 17:03:03