Cześć,
Napisałem sobie prosty programik który ma obliczać ceny biletów w zależności od przejechanych stacji.
Każda przejchana stacja to np. 10zł.
Poniżej kod, jest możliwość napisania tego krócej? Sam ręcznie musiałem wypisać wszystkie możliwie warianty rozpoczęcia oraz zakończenia podróży.
station = ("Londyn ->", "<- Station1 ->", "<- Station2 ->", "<- Manchester")
print("Select start and end of your journej")
print("Train road below")
print(station)
print("Select start")
start = input()
print("Select End")
end = input()
print("You select road from " + start + " to " + end)
if start == "Londyn" or start == "londyn":
if end == "Manchester" or end == "manchester":
print("The cost of travel 30 pound")
elif end == "Station2" or end == "station2":
print("The cost of travel 20 pound")
elif end == "Station1" or end == "station1":
print("The cost of travel 10 pound")
if start == "station1" or start == "Station1":
if end == "Manchester" or end == "manchester":
print("The cost of travel 20 pound")
elif end == "Station2" or end == "station2":
print("The cost of travel 10 pound")
elif end == "Londyn" or end == "londyn":
print("The cost of travel 10 pound")
if start == "Station2" or start == "station2":
if end == "Manchester" or end == "manchester":
print("The cost of travel 10 pound")
elif end == "Station1" or end == "station1":
print("The cost of travel 10 pound")
elif end == "Londyn" or end == "londyn":
print("The cost of travel 20 pound")
if start == "Manchester" or start == "manchester":
if end == "Londyn" or end == "londyn":
print("The cost of travel 30 pound")
elif end == "Station1" or end == "station1":
print("The cost of travel 20 pound")
elif end == "Londyn" or end == "londyn":
print("The cost of travel 30 pound")