Skip to content

modified number_search.py#6

Open
shashirama wants to merge 1 commit into
Mrsatatima:mainfrom
shashirama:main
Open

modified number_search.py#6
shashirama wants to merge 1 commit into
Mrsatatima:mainfrom
shashirama:main

Conversation

@shashirama

Copy link
Copy Markdown

I couldn't complete the coount_numbers function so only the count_fraction passed

Comment thread number_search.py
#print(match)
count += 1
return count
pass #TODO update the fucntion to pass test

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the pass

Comment thread number_search.py
TODO update doc strings
"""
count = 0
pattern = re.compile(r'(\d+| \d+\.\d+)')

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread number_search.py
count = 0
pattern = re.compile(r'(\d+| \d+\.\d+)')
with open('article.txt', 'r') as f:
file = f.read()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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..

Comment thread number_search.py
count+=1

return count
pass #TODO update the fucntion to pass test

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove pass

Comment thread number_search.py
count_numbers("article.txt")
#count_fraction("article.txt")
# Replace pass with your debugging code if any
pass

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove pass

@Mrsatatima Mrsatatima left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job.. make changes and get back to me thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants