lundi 11 janvier 2021

Why does this code have an IndentationError? [duplicate]

I am trying to write a program where the user enters a Int value then the int has to be compared using If statement and the result has to be printered and If the user enters a string then the message should be "you have entered a string value".

Can you let me know what is wrong with my program

print ("Enter a value")
input()
if int (value) == 10:
print('The value is 10')
if (value) == str:       (Its wrong in here)
print (' Enter a Number not text')
elif int (value) == 12:
print('The value is not 10')
else: 
print('The value is not a number')
Error message        File "<ipython-input-35-29c9dd2647d4>", line 6
     print (' Enter a Number not text') IndentationError: expected an indented block

Aucun commentaire:

Enregistrer un commentaire