So I'm trying to design two functions, one to create a list and one to check certain parameters within that list. The check() function is to see if any of the elements of the price() function's randomly generated list are >100 then inform the user which of those elements need to be recorded. To be honest, I'm not really sure where to begin with the check() function and was hoping someone might have some advice?
def price():
priceList = [1,2,3,4,5,6,7,8,9,10]
print ("Price of Item Sold:")
for i in range (10):
priceList[i] = random.uniform(1.0,1000.0)
print("${:7.2f}".format(priceList[i]))
print("\n")
return priceList
I know the check() function is way off, but like I said, not exactly sure where to go with it.
def check(priceList):
if priceList > 100
print ("This item needs to be recorded")
Thank you in advanced for any help!
priceListare less than 100? Or find which elements are great than 100?checkthese = [p for p in priceList if p > 100]priceList = [], since all the items will be replaced with random values anyway.