def shop(user,left): shoplist = file('H:\\python\\atm\\shoplist') shop_dic = {} time = 2015 print '\t\tshoplist', for line in shoplist.readlines(): new_line = line.split() print ''' \t%s\t\t|%d ''' % (new_line[0],int(new_line[1])), shop_dic[new_line[0]] = int(new_line[1]) while True: if left >= int(min(shop_dic.values())): want = raw_input('plz input you want buy:') if want == 'q' or want == 'quit': break while shop_dic.has_key(want): want_price = int(shop_dic.get(want)) if want_price >= left: print 'your cant buy this,another' break else: acttion = 'shop %s' %want left = left - want_price logbill(user,time,acttion,want_price,left) break else: print 'not this in list' else: print 'no enough money' break return left
def cashin(user,left): #user = '******' time = 2015 acttion = 'cashin\t' #left = 15000 cashin_num = int(raw_input('plz input the num you want cashin:')) left = left + cashin_num log_num = '+%s' % cashin_num logbill(user,time,acttion,log_num,left) return left
def withdaw(user,left): withdaw_num = int(raw_input('plz input you want withdaw:')) if withdaw_num * 1.05 <= left: intrest = withdaw_num * 0.05 left = left - withdaw_num - intrest log_num = '-%s' % withdaw_num logbill(user,time,acttion,log_num,left,intrest) print type(left) return left else: print 'you have not enough money' return left