python输出姓名、部门和工资、并输出最高工资_用Python从并行数组打印员工和工资...

该程序将确定什么样的工资是最高的,并将其与拥有该工资数字的员工的姓名一起打印出来。在

我需要列一份雇员名单和另一份工资清单。我可以找到最低/最高工资并打印出来,但我不知道如何打印出相应的员工。让这件事难办的是,我们只在第六章,我们只能利用我们目前所学的知识。所以我们不能使用Python提供的很多内置函数(我们甚至还没有介绍append()方法,所以我不得不使用另一种方法添加到列表中….)max和min也不允许使用。在amount = int(input("How many employees?: "))

if amount <= 0:

print("You cannot have 0 or less.")

name = []

salary = []

length = len(salary)

mini = 200000

maxi = 0

combined = (name, salary)

for i in range(1, amount + 1):

employee = input("What is the employee's name?: ")

name += [employee]

earned = int(input("How much is the salary? It cannot be less than 0 or over $200,000: "))

while earned <= 0 or earned >= 200000:

earned = int(input("How much is the salary? It cannot be less than 0 or over $200,000: "))

mini = earned

maxi = earned

salary += [earned]

total += earned

if earned < mini:

mini = earned

if earned > maxi:

maxi = earned

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值