Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def expensesManager():
- numCafes=requestInteger("How many Cafes?")
- coffeePrices=[None]*numCafes
- cafeNameList=[None]*numCafes
- total=0
- index=0
- while(index<numCafes):
- cafeNameList[index]=requestString("Name of cafe "+str(index))
- coffeePrices[index]=requestNumber("Price of a coffee at cafe "+cafeNameList[index])
- total=total+coffeePrices[index]
- index=index+1
- average=total/numCafes
- index=0
- while(index<numCafes):
- if coffeePrices[index]<average:
- print cafeNameList[index],"coffee is $",(average-coffeePrices[index]),"cheaper than average"
- index=index+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement