9. Write a python program to generate a lambda function to check whether the specified first letter "C" match with the input values randomly key in by user. (True or False)
The output is:
First letter: C
Expected Answer:
Python starts with C letter: False
C Programming starts with C letter: True
Sample Answer:
starts_with = lambda x: True if x.startswith('C') else False print("Python starts with C letter:", starts_with('Python')) starts_with = lambda x: True if x.startswith('C') else False print("C Programming starts with C letter:", starts_with('C_Programming'))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)