+ 1
Word equation!
Hello everyone! I am trying to make a code that can figure out how many times a user input word is written in a unser input text. What is the easiest way to do this? I am trying to learn python and have found a way it might work. If you have some websites or anything that might help please like them :)
7 odpowiedzi
+ 2
Try this. Its just a prototype. Ask questions if unsure.
https://code.sololearn.com/c6FsGQPvqy4l/?ref=app
+ 7
You might want to start from here:
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2475/?ref=app
Regular expressions are most likely the thing you need.
+ 4
How many times a user input word is written in a [what] ?
Could you be a bit more clear, or maybe provide an example?
+ 4
The easiest might be to open the file, .read() it, .split() and .strip() it and .count(word) it ;)
0
Okay i will try to be a bit more clear. If i write a text including 3000 word. Then i want to find out how many time a have written "many" for example. what would be the easiest way to code this?
0
nice! Thank you 😊
0
if i were to count the percentage of the words in the text, how do you think this can be made?
For example, Quick stand for 4 % of the text and so on :)