1

So first i clicked on Run Module

So first i clicked on Run Module

Then this came up

Error Image 2

My code

import time
    print("First we need to know you.")

print("Enter your name please.")
time.sleep(2)
name = input("Name: ")
print("Welcome, " + name + "!")
time.sleep(3)
criminal = input("Are you a criminal?: ")
if criminal=='Y':

Right here it highlights print as red

 print('Oh no')
    elif criminal=='N':
    print('Thank god!')

2 Answers 2

4

You need to indent after an if and the elif:

if criminal=='Y':
    print('Oh no')
elif criminal=='N':
    print('Thank god!')

Also, don't indent after the import:

import time
print("First we need to know you.")
Sign up to request clarification or add additional context in comments.

3 Comments

I'm very new to Python can you tell me what Indent means? (Sorry about this)
No problem :) Just four spaces in from the start of the line. If you look at my amended code, you can see the spaces there. It's the way Python tells how bits of code should be put together, or put in a "block". An "if" statement is special, because you need to know what to do for the if. Is it just the next one line, or 4 lines? The lines that correspond to the if should all be "indented" in order to tell Python "these lines are what to do if the statement is true".
You're welcome. You can upvote helpful answers on the left here, and if someone solved your problem, you can click the "tick" to accept the answer.
1

You have to indent the print('Oh no'):

if criminal=='Y':
    print('Oh no')
elif criminal=='N':
    print('Thank god!')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.