+ 2
Where I'm making mistake in this python question
Question: https://www.sololearn.com/coach/41?ref=app Answer body : criminals = int(input()) if criminals < 5 : print ("I got this!") if criminals >= 5 : print("Help me Batman") if criminals > 10: print ("Good Luck out there!")
13 Answers
+ 4
elif criminals >= 5:
Look at this line, what does it say? Is 10 great than 5? Yes, so any value greater than 5 will give you "Help me Batman".
Have you looked up and/or in an if statement? Check it out 😉
+ 4
Also Ausgrindtube Боб со Шрамом Jan Xmosity all your efforts really helped me to understand the core concept of problem solving in this question thanks to all of you dear mates 🙏💓
+ 3
You need to use a logical operator like....
>= 5 and <=10
...and then use elif and also indentation of at least two spaces.
+ 3
Naina Kapoor ,
>> please link your current code here, since we need to see what the issues are. <<
using `elif` alone will not help us, we also need to check / modify the conditional statements.
sample:
let us input 6.
...
elif criminals >= 5:
...
will output `Help me Batman`, but we will get the same answer when input is 14. this is because both of the values (6 and 14) are greater or equal than 5. but input 14 should give output: `Good Luck out there!`
so try to improve the conditional.
+ 3
Naina Kapoor ,
it is just one line to modify in your current code:
criminals = int(input())
if criminals < 5:
print("I got this!")
elif criminals <= 10: # <<<
print("Help me Batman")
elif criminals > 10:
print("Good Luck out there!")
+ 3
Lothar this worked out , huge thanks to you 🥰
+ 3
good luck to learning python!
+ 2
Same as your post here:
https://www.sololearn.com/Discuss/3291603/?ref=app
Use elif
+ 2
Ausgrindtube still not working
+ 2
You put some random spaces, like before the colons and between the last print and ().
+ 2
Lothar what sort of thanks logic I can use sir to range the numbers between (5-10) in statement
Also thanks for your explanation above 😄
+ 1
in first, between 5 and : there's shouldn't be spaces
in second, use elif