10. Write a python program to generate a lambda function to check whether a given string is a number or not. (True or False)
The output is:
Example of Expected Answer:
Is the given 3687 a number: True
Is the given Python a number: False
Sample Answer:
is_num = lambda q: q.replace('.','',1).isdigit() print("Is the given 3687 a number:", is_num('3687')) print("Is the given Python a number:", is_num('Python'))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)