试图从数组的每个元素中减去一个变量

时间:2017-12-06 13:12:11

标签: python-3.x

您好我有一个代码可以创建一个旅行的价格。我试图从一个数组的每个元素中减去一个变量。为了得到剩余的金额

pricepaidpp = []
namepeoplecoming = []
amountlefttopaypp = []

extrapeoplecount = 0  
moneycollected = 0
peoplecount = 0 
numofextrapeople = 0
totalpeoplecoming = numofpeople + Numofcarersneeded
moneypaidcalc = 00


while True:
    entry = input('Enter Name of people coming  ')
    moneyentry = input ('How much has he paid ')

    if peoplecount >= numofpeople : #breaks loop when number of people 
    reached 
    break



namepeoplecoming.append(entry) #adds the name the user  to the array 

pricepaidpp.append(moneyentry)  #adds how much the user has paid to the array 

pricepaidpp = list(map(int, pricepaidpp)) #turn strings in array to integers 

moneyentry = list(map(int, pricepaidpp)) 

amountlefttopaypp.append(moneyentry)

peoplecount = (peoplecount + 1 ) #adds one to the count 

moneycollected = sum(pricepaidpp)   #adds values of the array to get the total money paid 

amountlefttopaypp = [x-costpp for x in amountlefttopaypp]

#need code to minus price per person from amountlefttopaypp

每当我尝试somthing时我得到typeError:不支持的操作数类型 - :'float'和'list

0 个答案:

没有答案