def repay(): ''' 银行卡还款,无论是信用卡或储蓄卡,是否能充任意大小的金额 :return: ''' while True: # 1) 让用户输入还款金额 input_money = input('请输入需要还款的金额: ').strip() # 2)判断用户输入的是否是数字 if not input_money.isdigit(): print('请输入正确的金额') continue input_money = int(input_money) # 3) 判断用户输入的金额大于0 if input_money > 0: # 4)调用还款接口 flag, msg = bank_interface.repay_interface( login_user, input_money ) if flag: print(msg) break else: print('输入的金额不能小于0')
def repay(): while True: money = input('请输入你需要还款的金额:').strip() #判断输入是否为数字 if not money.isdigit(): print('请输入数字') continue flag, msg = bank_interface.repay_interface(money, user_info['user']) if flag: print(msg) break
def repay(): print('欢迎来到还款支付功能') while True: money = input('请输入支付还款金额').strip() if not money.isdigit(): print('必须输入数字') continue money = int(money) msg = bank_interface.repay_interface(user_info.get('username'), money) print(msg) break
def repay(): while True: money = input('请输入还款金额:').strip() if not money.isdigit(): print('必须是数字!') continue money = int(money) msg = bank_interface.repay_interface(user_info.get('user'), money) print(msg) break
def repay(): while 1: re_num = input('请输入金额:\n>>>').strip() if re_num.isdigit(): re_num = float(re_num) if re_num > 0: _, msg = bank_interface.repay_interface(login_user, re_num) print(msg) break else: print('请输入正确的数字!') else: print('请输入数字')
def repay(): while True: money = input("请输入还款金额(输入q退出):").strip() if money == 'q': break if money.isdigit(): money = int(money) msg = bank_interface.repay_interface(user_info["name"], money) print(msg) break else: print("非法输入,请重新输入数字") continue
def repay(): while True: input_money = input('请输入还款金额:').strip() if not input_money.isdigit(): print('请输入数字') continue input_money = int(input_money) if input_money > 0: flag, msg = bank_interface.repay_interface(login_user, input_money) if flag: print(msg) break else: print(msg)
def repay(): while True: input_money = input('请输入需要还款的金额:').strip() if not input_money.isdigit(): print('请输入正确的金额!') continue input_money = int(input_money) if input_money > 0: # 调用还款接口 flag, msg = bank_interface.repay_interface(login_user, input_money) if flag: print(msg) break else: print('输入的金额不能小于0!')
def repay(): while True: repay_money=input('请输入还款金额:').strip() if not repay_money.isdigit(): print('请输入正确的金额') continue repay_money=int(repay_money) if repay_money<=0: print('还款金额必须大于0') continue else: flag,msg=bank_interface.repay_interface(login_user,repay_money) if flag: print(msg) break
def repay(): while True: input_money = input('请输入还款金额:') try: input_money = float(input_money) except ValueError: print('请输入正确金额:') continue if input_money > 0: flag, msg = bank_interface.repay_interface(login_user, input_money) if flag: print(msg) break else: print('输入金额不能小于0。')
def repay(): while True: money = input('请输入还款金额: ').strip() if not money.isdigit(): print('请输入数字') continue money = int(money) flag, msg = bank_interface.repay_interface(user_info['user'], money) if flag: print(msg) break
def shopping_pay_interface(username,shopping_car,cost): flag = bank_interface.repay_interface(username,cost) user_dic = db_handler.select(username) if flag: user_dic['shop_car'] = {} db_handler.save(user_dic) return True,'购物并支付成功' #若失败,保存购物车 else: user_dic['shop_car'] = shopping_car db_handler.save(user_dic) return False,'支付失败,保存购物车'
def repay(): while True: # 接收用户输入的金额 money = input('请输入还款金额:').strip() #用户输入正确性校验 if not money.isdigit(): print('请输入正确的金额') continue money = float(money) if money <= 0: print('请输入正确的金额') continue # 调用银行接口 flag, msg = bank_interface.repay_interface(login_user, money) print(msg) if flag: break
def repay(): print('欢迎来到还款界面') while True: money = input('请输入还款金额按q退出') if money == 'q': break if money.isdigit(): money = int(money) flag, msg = bank_interface.repay_interface(user_inf.get('user'), money) if flag: print(msg) break else: print(msg) else: print('还款金额必须是数字')