-4

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
Random Davis
  • 6,662
  • 4
  • 14
  • 24
  • 1
    Do you know how important indentation is in Python? Have you looked up how indentation works? – Random Davis Jan 11 '21 at 18:05
  • Thats what you get when you copy paste code from some word file or pdf etc. – Ezio Jan 11 '21 at 18:06
  • When i try to bols my post in stackoverflow i was not able to post in the way which i had so i posted as it was – Lokesh Govindaraju Jan 11 '21 at 18:43
  • print (' Enter a number : ') input() if int(w) == 10: print('The value is 10') elif int(w) == 20: print('The value is 20') else: print('The value is 30') – Lokesh Govindaraju Jan 11 '21 at 18:43
  • @LokeshGovindaraju it's useless to post code in comments, since it gets rid of formatting and whitespace. Whitespace/indentation is critical in Python anyway like I said. – Random Davis Jan 12 '21 at 23:45

1 Answers1

-1
print("Enter a value")
value = input()
if not value.isnumeric():
    print("Enter a Number not text")
elif int (value) == 10:
    print("The value is 10") 
elif int (value) == 12: 
    print("The value is not 10")
Mick
  • 796
  • 4
  • 8