Hi everyone, I can't seem to find where I got it wrong. The elif statement is not recognised in my code. Please I need help. | Sololearn: Learn to code for FREE!

0

Hi everyone, I can't seem to find where I got it wrong. The elif statement is not recognised in my code. Please I need help.

answer = input("\nWhat is the capital of Nigeria? \n>>>") if answer == "Abuja" or "abuja" or "ABUJA" : print(answer, "is correct ✅") elif answer!= "Abuja" or "abuja" or "ABUJA" : print(answer, "is a wrong answer ❌ ")

10/21/2021 5:43:51 PM

Alpha

7 Answers

New Answer

+4

Dear, in the first place, your <if condition> is wrong. It was supposed to be like this: if answer=="ABUJA" or answer=="Abuja" or answer=="abuja": #CODE HERE And there is no need of <elif> here, though, with elif you could do it like this: if #coditions: #CODE elif answer=="ALPHA" or #other conditions: #CODE

+6

u don’t need elif in this case just use else answer = input() if answer.lower() == "abuja": print(answer, "is correct ✅") else: print(answer, "is a wrong answer ❌ ")

+2

if answer == "Abuja" or answer == "abuja " or answer == "ABUJA" : print() else: print() you don't need to use elif. else is enough in your case.

+1

[BusyTheseDays] thanks alot 🙌🏼 your answer was helpful ✅🐾

+1

Bahha🐧 thanks 🙌🏼✅🐾

+1

https://code.sololearn.com/WeIq2VoM0o00/?ref=app https://code.sololearn.com/cc2ySmfPZ9MC/?ref=app

0

ubai thanks alot 🙌🏼 your answer was helpful ✅🐾 I never knew how to use the .lower() module but now it's good to know it's useful.