Python-Home-Challenges-Maor Weiss#10
Python-Home-Challenges-Maor Weiss#10MaorW wants to merge 4 commits intoknowabli:masterfrom MaorW:master
Conversation
| biggest_counting = 0 | ||
| count = 0 | ||
|
|
||
| copy_list = split_words_from_file |
There was a problem hiding this comment.
no reason to declare new variable here
There was a problem hiding this comment.
Do you mean new variables? or just count variable..? @AviadP
There was a problem hiding this comment.
there is no reason just to assign "split_words_from_file" into "copy_list"
| else: | ||
| count = 0 | ||
|
|
||
| print 'The word "{}" which has appeared {} times is the most recurring word in the file.'.format(the_most_recurring_word, biggest_counting) |
There was a problem hiding this comment.
syntax error, missing '('
also, using f' string is considered as best practice for python 3
| count = 0 | ||
|
|
||
| print 'The word "{}" which has appeared {} times is the most recurring word in the file.'.format(the_most_recurring_word, biggest_counting) | ||
| fp.close() |
There was a problem hiding this comment.
using close is important, but in case of error or exception, your script wont get to that point, and file will remain open. best practice is is to use "with...open..." for files operations
There was a problem hiding this comment.
Working on it. But why my script won't get to that point?
There was a problem hiding this comment.
in case of exception in one of previous lines, like syntax error, type error etc.
|
@AviadP |
#8 @AviadP