def select(): salary = send_money.send() if salary == 0: print(f"未发放工资,这个月要吃土了,存款余额:{money.saved_money}") elif salary >= 1: saved_money = salary * 1000 + 1000 print(f"工资已经发放,当前存款为:{saved_money}") else: print("输入的次数不符合规范,请重新输入")
# 定义一个start.py ,启动文件展示最终存款金额 import yaml import send_money import select_money if __name__ == '__main__': with open(yaml.safe_load('data.yml'),encoding= 'utf-8') as f: dates = yaml.safe_load(f) print(dates['sal']) a = dates['sal']['a'] send_money.send(a) select_money.select()
from select_money import select from send_money import send if __name__ == '__main__': send() select()
""" 原有存款 1000元, 发工资之后存款变为2000元 定义模块 1、money.py saved_money = 1000 2、定义发工资模块 send_money,用来增加收入计算 3、定义工资查询模块 select_money,用来展示工资数额 4、定义一个start.py ,启动文件展示最终存款金额 """ import money from send_money import send from select_money import select if __name__ == '__main__': select() final_money = money.save_money + send() print(f"最终存款金额为:{final_money}")