|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
自己的写的,初学者,还请多多指教
#票价计算器
import easygui as g
title = '门票计算系统'
fieldName = ['星期','成人人数', '小孩人数']
fieldValues = []
msg = '星期和人数请输入阿拉伯数字\n平日票价100\n周末票价为平日120%\n儿童半价\n'
fieldValues = g.multenterbox(msg, title, fieldName, fieldValues)
weekend = int(fieldValues[0])
adult = int(fieldValues[1])
child = int(fieldValues[2])
adprice = 100
def output():
msg = ('%d成人和%d小孩总票价为:%.2f' % (adult, child, ticket))
g.msgbox(msg,title)
if weekend > 5 and weekend < 8:
ticket = adult*1.2*adprice + child*0.5*adprice
output()
elif weekend <=5 and weekend >= 1:
ticket = adult*1*adprice + child*0.5*adprice
output()
else:
g.msgbox('输入有误,请检查!',title) |
|