Question: I need python to check if a variable is an integer or not, then act accordingly.

Here is the pertinent code:

```
def data_grab():
    global fl_count #forklift count
    print("How many Heavy-lift forklifts can you replace?\n\n"
          "Please note: Only forklifts that have greater than 8,000 lbs. of lift capacity will qualify for this incentive.\n"
          "**Forklifts do  NOT need to be located at a port or airport to be eligible.**")
    forklift_count = input("Enter in # of forklifts:")
    if type(forklift_count) is int:
        fl_count = forklift_count
    else: 
        print("Invalid number. Please try again.")    
        data_grab()                       

```

Currently, when the user actually types in an integer, it will automatically jump to ELSE instead of executing the code under IF.

Any thoughts?

Answer: 
Try the [`str.isdigit()`](https://docs.python.org/3/library/stdtypes.html#str.isdigit) method:

```
forklift_count = input("Enter in # of forklifts:")
if forklift_count.isdigit():
    # Use int(forklift_count) to convert type to integer as pointed out by @MattDMo
    fl_count = forklift_count  
else: 
    print("Invalid number. Please try again.")  

```

From the documentation:

> 
> ### `str.isdigit()`
> 
> 
> Return True if all characters in the string are digits and there is at least one character, False otherwise.
> 
> 
>
A beginner/possibly incomplete answer here, but you could wrap the input() with int().

```
forklift_count = int(input("Enter in # of forklifts:"))

```

input() returns a string so even if you enter an int it will treat as string unless you convert it.