Strings in Python
Count the number of characters in a given string Program: text="hello how are you?" print(len(text)) Output: 18 Count the number of words in a given string Program: #split function is used to splits a string into list. text="hello how are you?" print(len(text.split())) Output: 4 Print Unique words from the given string Program : text="hello how are you where are you are you going threre" print(set(text.split())) Output: {'you', 'where', 'are', 'threre', 'how', 'hello', 'going'} Print Unique words from the given string Program : text="hello how are you where are you are you going threre" print(len(set(text.split()))) Output: 7 Calculation of Lexical Diversity One of the most commonly used approaches to measure LD is to use the ratio of unique lexical items divided by the total number of words in a sample Program text="hello how are you where are you are you going threre...