Ask coding questions

← Back to all posts
Is it posible to do: something == integer
Alebot33 (0)

If I want to do something like

x = input("Tell me a number:")

if x == integer <-- This is what I don't know.
print("Good")

Comments
hotnewtop
dumbCodr (3)
if x.isdigit():
  #do something
xxpertHacker (864)

if x == str(integer):

AndrewMarkarian (15)
x = input(¨Tell me a number¨)

if x == int:
  print(¨Good!¨)
else:
  print(¨Bad¨)

And what language is this because I mainly use Python.

Coder100 (16733)

Yeah, but the input is always str so it doesn't count

x = input("test: ")
try:
  int(x)
  print(" is int! ")
except:
  print("not int!")