heck values in the Array is a String
Given an array
Input:
input:
["apple","goa","hyderabad"]
output:
true
input:
["dog","fox","70","movie"]
output:
false
myArray1=["apple","goa","hyderabad"]
myArray2=["dog","fox","70","movie"]
def check_int_in_str(lis):
for n in lis:
try:
float(n)
l = 'False'
print(l)
break
except (ValueError, TypeError):
l = 'True'
if l=='True':
print(l)
check_int_in_str(myArray1)
check_int_in_str(myArray2)
Comments
Leave a comment