[Tutor] Help!

Andrew Bouchot andy.a.bouchot at gmail.com
Thu Mar 3 22:28:33 CET 2011


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???
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110303/776f6aa9/attachment-0001.html>


More information about the Tutor mailing list