Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update Validatingphonenumbers.py #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
arsho merged 3 commits into arsho:master from HighnessAtharva:patch-10
Apr 3, 2021
Merged

Update Validatingphonenumbers.py #30

arsho merged 3 commits into arsho:master from HighnessAtharva:patch-10
Apr 3, 2021

Conversation

Copy link
Contributor

@HighnessAtharva HighnessAtharva commented Apr 3, 2021

Updated Code to Python3 standards.

Copy link
Owner

@arsho arsho left a comment

Choose a reason for hiding this comment

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

Please accommodate the review comment.

Problem : https://www.hackerrank.com/challenges/validating-the-phone-number/problem
'''
# Enter your code here. Read input from STDIN. Print output to STDOUT
n=int(raw_input())
n=int(input())
Copy link
Owner

Choose a reason for hiding this comment

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

@HighnessAtharva ,

The following code is using regex. Please update the PR with this:

from re import compile, match
n = int(input())
for _ in range(n):
 phone_number = input()
 condition = compile(r'^[7-9]\d{9}$')
 if bool(match(condition, phone_number)):
 print("YES")
 else:
 print("NO")

HighnessAtharva reacted with thumbs up emoji
Copy link
Contributor Author

@HighnessAtharva HighnessAtharva Apr 3, 2021

Choose a reason for hiding this comment

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

Done.

Regex solution added as suggested.
Copy link
Owner

@arsho arsho left a comment

Choose a reason for hiding this comment

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

Splendid!

@arsho arsho merged commit b9826f6 into arsho:master Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@arsho arsho arsho approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /