[Tutor] Help!
David Hutto
smokefloat at gmail.com
Thu Mar 3 23:08:12 CET 2011
On Thu, Mar 3, 2011 at 4:56 PM, Knacktus <knacktus at googlemail.com> wrote:
> 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
>
Maybe I understood it wrong, but they ask "but how would i add the 5
min and 13 seconds after 143 items have been produced???", which is
produce 143, then wait 5:13. Those times are irrelevant, unless the
need is in between the produced 143, which would make the pseudo:
> count = 0
> while count != 144
> do stuff
time.sleep(5:13/143 interval)
count += 1
> HTH,
>
> Jan
>
>>
>>
>>
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
--
According to theoretical physics, the division of spatial intervals as
the universe evolves gives rise to the fact that in another timeline,
your interdimensional counterpart received helpful advice from me...so
be eternally pleased for them.
More information about the Tutor
mailing list