地铁车票
购买地铁车票的规定如下:
乘 1~4 站,3 元/位;
乘 5~9 站,4 元/位;
乘 9 站以上,5 元/位。
请用程序实现
输入乘坐人数(per_num)和乘坐站数(sta_num),计算购买地铁车票需要的总金额,并将计算结果输出。
注意: 如果「乘坐人数」和「乘坐站数」为0或负数,输出error。
per_num=int(input())
sta_num=int(input())
if per_num<=0 or sta_num<=0:
print("error")
else:
if 1<=sta_num<=4:
pm=3
if 5<=sta_num<=9:
pm=4
if sta_num>9:
pm=5
count=pm*per_num
print(count)