This isn't so much as a python problem as it is a simple math problem, and I feel you are being lazy, but in the offchance you're having problems with the '/' operator:
cooloff = (numitems/143)*313 total = cooloff + seconds I think you are using python 2.6 (and I guess 2.7) or older based on your print statement. I could be totally wrong, in which case numitems/143 will not work correctly. In 2.6 and older the / operator does floor division. You are almost assuredly going to get flamed for not having a descriptive title and for asking what is obviously homework questions On Thu, Mar 3, 2011 at 4:28 PM, Andrew Bouchot <andy.a.bouc...@gmail.com>wrote: > okay so this is my comp sci lab > > * > > Problem: > *ProductionTime.py It takes exactly 2 minutes and 7 second to produce an > item. Unfortunately, after 143 items are produced, the fabricator must cool > off for 5 minutes and 13 seconds before it can continue. Write a program > that will calculate the amount of time required to manufacture a given > number of items. * > > Output: > *Output the amount of time D days HH:MM:SS * > > Sample Input : > * > > numItems =1340 Represents the numbers items to be manufactured > * > > Sample Output : > * > > 2 days 00:03:17 > > > > this is the coding i have written for it! > > numitems= int(raw_input("Enter the number of items needed to be > manufactured:")) > seconds=numitems*127 > m, s = divmod(seconds, 60) > h, m = divmod(m, 60) > print "%d:%02d:%02d" % (h, m, s) > > but how would i add the 5 min and 13 seconds after 143 items have been > produced??? > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor