Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I Need Help I am Getting Indentation error

so Well I was trying to do some python for an trivia Game But It Showed Me and error Called:
IndentationError: expected an indented block after ‘if’ statement on line 8
Its giving me this error and I need a Fix for This I need Help please here is the python:

print('Welcome To Minecraft Trivia!')

ans = input('are you ready to play (yes/no):')
score = 0
total_q = 5
if ans.lower() == 'yes':
 ans = input('1. Who Was The Original creator of Minecraft? (First name)')
 if ans.lower() == 'Notch':
score += 1
print('Correct Bravo!')
else:
    print('boo Thats incorrect')

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

As the error states, the problem is the indentation at the line specified. You should indent the code inside the second if

print('Welcome To Minecraft Trivia!')

ans = input('are you ready to play (yes/no):')
score = 0
total_q = 5
if ans.lower() == 'yes':
   ans = input('1. Who Was The Original creator of Minecraft? (First name)')
   if ans.lower() == 'Notch':
       score += 1
       print('Correct Bravo!')
   else:
       print('boo Thats incorrect')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading