学校の場合、私は割り当てをしていますが、何をすべきかわかりません。1リスト内の値を比較してください
私は2つのステーション、beginStation(start)とeindStation(end)を持っています。最初に、彼らが駅のリストに入っているかどうかをチェックしなければなりませんでした。これはうまくいった。 しかし、同じリスト内で、eStationStationがbeginStationの後に来るかどうかをチェックする必要があります。
stations_place = {"Schagen" : 1, "Heerhugowaard" : 2, "Alkmaar" : 3, "Castricum" : 4, "Zaandam" : 5, "Amsterdam Sloterdijk" : 6, "Amsterdam Centraal" : 7, "Amsterdam Amstel" : 8, "Utrecht Centraal" : 9, "'s-Hertogenbosch" : 10, "Eindhoven" : 11, "Weert" : 12, "Roermond" : 13, "Sittard" : 14, "Maastricht" : 15}
eindStation = str(input("What is your end station? "))
if eindStation in stations_place:
print("good") #just to check if the code does it's job here
else :
print("This station isn't available, endstation is: Maastricht")
if eindStation >= beginStation in stations_place.values:
print("good") #just to check if the code does it's job here
else:
print("This station isn't available, endstation is: Maastricht")
私があなたを助けてくれることを願っています。前もって感謝します!