[英]Print pairs of values from two lists
Everything is working for me in this program except for one thing;在这个程序中,除了一件事外,一切都对我有用; I need my output to group the names and values together in the print(names, "\\n" values)
section.我需要我的输出在print(names, "\\n" values)
部分将名称和值组合在一起。
For example: Pat : €99, Kev : €55, Dermot : €100
.例如: Pat : €99, Kev : €55, Dermot : €100
。
My code is below:我的代码如下:
salesperson = int(input("How many salesperson's do you wish to account
for:"))
names = []
values = []
counter = 0
total_sales = 0
total_value = 0
if salesperson > counter:
while salesperson != counter:
name = input("Please enter in the salesperson's name:")
value = float(input("Please enter in the value of sales for the
salesperson:"))
salesperson -= 1
names.append(name)
values.append(value)
total_value += value
from statistics import mean
average_values = mean(values)
minimum = min(values)
maximum = max(values)
print(names,"\n",values)
print(average_values)
print(total_value)
print(minimum)
print(maximum)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.