What Would be the Test case 5, Everything seems to be right!! But showing error in test case 5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What Would be the Test case 5, Everything seems to be right!! But showing error in test case 5

Ques) You are a police officer, and you get a report of criminal activity! Should you go on your own, or should you call a superhero to help you fight the crime? If there are less than 5, you can handle this on your own, if there are 5-10, you will want to go with Batman for backup, and if there are more than 10, you should stay where it is safe and let Batman handle this on his own! Task: Determine whether you need to call backup based on the total number of criminals being reported. Input Format: An integer that represents the total number of criminals present at the scene. Output Format: A string that says 'I got this!', 'Help me Batman', or 'Good Luck out there!' depending on the scenario. Sample Input: 7 Sample Output: 'Help me Batman' Ans) *my code* cr=int(input()) if cr>0: if cr<5: print("I got this!") elif (cr>=5 and cr<=10): print("Help me Batman") else: print("Good Luck out there!")

26th Jan 2022, 6:40 PM
VᎥᏨ𐍂ᗩ𐌼
VᎥᏨ𐍂ᗩ𐌼 - avatar
3 Answers
+ 1
I think you need to remove the line if cr > 0 In case of cr == 0 you print nothing.
26th Jan 2022, 7:13 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
I would remove if cr > 0:
26th Jan 2022, 7:15 PM
JaScript
JaScript - avatar
+ 1
cr=int(input()) if cr==0: print() if cr<0: print() else : if cr<5: print("I got this!") elif (cr>=5 and cr<=10): print("Help me Batman") else: print("Good Luck out there!") Solved√√
27th Jan 2022, 3:10 AM
VᎥᏨ𐍂ᗩ𐌼
VᎥᏨ𐍂ᗩ𐌼 - avatar