awacke1 commited on
Commit
39bf55d
β€’
1 Parent(s): 7296008

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -91,14 +91,13 @@ from bs4 import BeautifulSoup as bs
91
  import lxml.etree as xml
92
  import lxml
93
 
94
- word = input('enter the word: ')
95
- url = f'https://www.dictionary.com/browse/{word}?s=t'
96
- web_page = bs(requests.get(url, {}).text, "lxml")
97
- meanings = web_page.find_all('div', attrs={'class': 'css-1ghs5zt e1q3nk1v2'})
98
- print('\nThe meaning(s) of the word is: ')
99
- # for all the meanings
100
- for meaning in meanings:
101
- st.write('* '+ meaning.text)
102
- st.write('\n')
103
- # for most common meaning
104
- st.write(meanings[0].text)
 
91
  import lxml.etree as xml
92
  import lxml
93
 
94
+ def define(word):
95
+ url = f'https://www.dictionary.com/browse/{word}?s=t'
96
+ web_page = bs(requests.get(url, {}).text, "lxml")
97
+ meanings = web_page.find_all('div', attrs={'class': 'css-1ghs5zt e1q3nk1v2'})
98
+ for meaning in meanings:
99
+ st.write('* '+ meaning.text)
100
+ st.write(meanings[0].text)
101
+
102
+ for word in clue_result7:
103
+ define(word)