Skip to main content
deleted 129 characters in body
Source Link
mkrieger1
  • 24.2k
  • 7
  • 68
  • 84

If you just want integers and reject decimal numbers. You, you can use the following function to check.

def isInteger(string): if string[0] == '-': #if a negative number return string[1:].isdigit() else: return string.isdigit()

 
def isInteger(string): if string[0] == '-': #if a negative number return string[1:].isdigit() else: return string.isdigit() 

If you just want integers and reject decimal numbers. You can use the following function to check.

def isInteger(string): if string[0] == '-': #if a negative number return string[1:].isdigit() else: return string.isdigit()

 

If you just want integers and reject decimal numbers, you can use the following function to check.

def isInteger(string): if string[0] == '-': #if a negative number return string[1:].isdigit() else: return string.isdigit() 
Source Link
J Z
  • 96
  • 6

If you just want integers and reject decimal numbers. You can use the following function to check.

def isInteger(string): if string[0] == '-': #if a negative number return string[1:].isdigit() else: return string.isdigit()