## Tuesday, November 10, 2020

Solution Exercise 86: a python algorithm which determines all the words in a given string text #### Eercise 86 *

Write an algorithm in Python which determines the set of words that make up a text string s. Example if s = "Python is more power than Java", the algorithm returns the set:
``{Python, is, more, power, than, Java}``

#### Solution

``````# creation of a function which returns all the words that make up a text string s.
def wordSet (s):

# initialize the set of words
Set = set ({})

# convert the string to a list
ListWords = s.split ()
# browse the words in the ListWords list
for word in ListWords:
return Set
# Example
s = "Python is more power than Java"
print (wordSet (s))
# output: {'is', 'power', 'Java', 'more', 'Python', 'than'}``````

Younes Derfoufi
my-courses.net

## Python Exercises With Solutions

1. Python Arithmetic Exercises
2. Equations & System Of Equations
3. Polynomials and Functions
4. Python Arithmetic Exercises
5. Numpy, Matplolib, Sympy , Scipy - Exercises
6. Python Arithmetic Exercises

Younes Derfoufi

## Sample Text 