[Tutor] Help!

Knacktus knacktus at googlemail.com
Thu Mar 3 22:56:06 CET 2011


Am 03.03.2011 22:28, schrieb Andrew Bouchot:
> 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???
For any given number of item, how many cool-down periods do you have in 
total?
What's the prodcution time without cooling?

-----------|++++++++|-----------|++++++++|----------|++++++++|------
producing  |cooling |producing  |cooling |producing |cooling |producing

HTH,

Jan

>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list