2
GOTHAM CITY Challenge (level 1)
You are a police officer and need to report a criminal activity and on report you will give a number from 0 to 10 regarding the level of the crime.
Make a code that receives by the user a number from 0 to 10,
if the number is less than 5, print on the screen "Police can resolve!". If the number is between 5 and 8, print on the screen "We need the help from Batman!". If the number is greater than 8, print on the screen "Leave that Batman can handle on his own!".
Annotations:
- so that the user can enter a value, use the function
input()
- so that you can check more than one if condition, use the
elif
which in Python meanselse if
.
My code:
n = int(input('De 0 a 10, qual a gravidade do crime?: '))
if n < 5:
print('Os policiais podem resolver')
elif n >= 5:
print('Os policiais precisam da ajuda do Batman!')
elif n <= 8:
print('Os policiais precisam da ajuda do Batman!')
else:
print('O Batman resolve sozinho!')
Where is the error in my code? I employed some wrong use of some condition?
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site
– Maniero