-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Noam ossia's challenge HW #12
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
with open('sample.txt', 'r') as file: | ||
data = file.read().replace('\n', '') | ||
print("The content of the file is:\n\n" + data) | ||
|
||
|
||
import re | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all imports should be at the head of the file |
||
words = re.sub("[^\w]", " ", data).split() | ||
|
||
for word in words: | ||
from collections import Counter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never use import within a loop |
||
word_counts = Counter(words) | ||
|
||
MOword = word_counts.most_common(1)[0][0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should not use this module to solve the challenge. your should write your own algorithm |
||
MOtimes = word_counts.most_common(1)[0][1] | ||
|
||
print("\nThe most occuring word is {} and it occurs {} times".format(MOword,MOtimes)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using f' string is best practice for python3, plz use this method |
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
I would love to try or hear the sample audio your app can produce. I do not want to purchase, because I've purchased so many apps that say they do something and do not deliver. Can you please add audio samples with text you've converted? I'd love to see the end results.Thanks!sfsdfasf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz use f' string instead,
also, this output is not needed