Answers for "check if an integer or not"

6

python check if int

colors = [11, 34.1, 98.2, 43, 45.1, 54, 54]

for x in colors:
    if int(x) == x:
    	print(x)
        
    #or
    if isinstance(x, int):
      	print(x)
Posted by: Guest on January-09-2020
0

check if value is number

if(isNaN(num1))
OR:
if(typeof num1 == 'number'){
    document.write(num1 + " is a number <br/>");
 }else{
    document.write(num1 + " is not a number <br/>");
 }
Posted by: Guest on September-12-2021

Code answers related to "check if an integer or not"

Python Answers by Framework

Browse Popular Code Answers by Language