Answer to Question #336255 in Python for sandhya

Question #336255

candies:

Rose bought 3 boxes of candies each box contains candies only of one specific flavor

box1:blue raspberry flavor

box2:butterscotch flavor

box3:cherry flavor

each day rose eats exactly two candies flavor(she won't eat two candies of the same flavor in a day)she won't eat more than 2 candies or 1 candy in a day .your task is to find the maximum number of days rose can keep eating candies.

input:

the 1st line input contains 3 space-separated integers A,B,C denoting the no.of blue raspberry, butterscatch and cherry candies respectively

input: 1 1 1

output:1

i/p:1 2 1

o/p:2


1
Expert's answer
2022-05-02T13:37:16-0400
i_p = input("Enter the number of candies of each type: ").split(' ')
number = [int(i) for i in i_p]
day = 0
end = True

while end:
    number = sorted(number)
    number[2] = number[2] - 1
    number[1] = number[1] - 1
    number = sorted(number)
    day += 1
    if number[0] == 0 and number[1] == 0:
        end = False
print(day)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS