modified number_search.py#6
Open
shashirama wants to merge 1 commit into
Open
Conversation
Mrsatatima
reviewed
May 29, 2021
| #print(match) | ||
| count += 1 | ||
| return count | ||
| pass #TODO update the fucntion to pass test |
Mrsatatima
reviewed
May 29, 2021
| TODO update doc strings | ||
| """ | ||
| count = 0 | ||
| pattern = re.compile(r'(\d+| \d+\.\d+)') |
Owner
There was a problem hiding this comment.
good job on the pattern.. but it will capture anything number no matter what is preceding it i.e. 12years or 2x or 23:34 or 2.3.3 are not numbers but your pattern will capture it. so update the pattern
Mrsatatima
reviewed
May 29, 2021
| count = 0 | ||
| pattern = re.compile(r'(\d+| \d+\.\d+)') | ||
| with open('article.txt', 'r') as f: | ||
| file = f.read() |
Owner
There was a problem hiding this comment.
try to convert the sting "file" to list of strings by splitting it by space using .split() method.. increase your accuracy as regex doesn't know when to stop.. in a long text if it comes across 23b it will match the 23 and leave the b which is not accurate..
Mrsatatima
reviewed
May 29, 2021
| count+=1 | ||
|
|
||
| return count | ||
| pass #TODO update the fucntion to pass test |
Mrsatatima
reviewed
May 29, 2021
| count_numbers("article.txt") | ||
| #count_fraction("article.txt") | ||
| # Replace pass with your debugging code if any | ||
| pass |
Mrsatatima
requested changes
May 29, 2021
Mrsatatima
left a comment
Owner
There was a problem hiding this comment.
good job.. make changes and get back to me thank you
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I couldn't complete the coount_numbers function so only the count_fraction passed