Answer to Question #221478 in Python for Hari nadh babu

Question #221478
M = int(input())
P = int(input())
C = int(input())
list1 = [M,P,C]
list2 = []
for i in list1:
  list1.remove(i)
  for j in list1:
    if i + j >= 100 and M + P + C >= 180:
      list2.append(True)
    else:
      list2.append(False)
if False in list2:
  print(False)
else:
  print(True)

The Above code have three test cases, but they were getting only two test cases as expected output, third test case were not getting expected output.

Question url link :- https://drive.google.com/file/d/1xObf_3zdyEfD8yEtB5V4OqL6HVzEd7h1/view?usp=sharing

The test cases are below

Test Case – 1

Input

82

55

45

Output

True

 

Test Case – 2

Input

71

30

70

Output

False

Test Case – 3

Input

40

90

50

Output

True


1
Expert's answer
2021-08-06T05:16:05-0400


M = int(input())
P = int(input())
C = int(input())

Flag=0
if((M+P)>=100 or (P+C)>=100 or (M+C)>=100):
  Flag=1
if(Flag==1 and (M+P+C)>=180):
  Flag=2

if(Flag==2): print(True)
else       : print(False)




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