-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Enter your code here. Read input from STDIN. Print output to STDOUT | ||
import re | ||
|
||
|
||
class Main(): | ||
def __init__(self): | ||
self.n = int(input()) | ||
|
||
for i in range(self.n): | ||
self.s = input() | ||
print(bool(re.match(r'^[-+]?[0-9]*\.[0-9]+$', self.s))) | ||
|
||
|
||
if __name__ == '__main__': | ||
obj = Main() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Enter your code here. Read input from STDIN. Print output to STDOUT | ||
import re | ||
|
||
m = re.search(r'([a-zA-Z0-9])\1+', input().strip()) | ||
print(m.group(1) if m else -1) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
cube = lambda x: x ** 3 | ||
|
||
|
||
def fibonacci(n): | ||
List = [0, 1] | ||
for i in range(2, n): | ||
List.append(List[i - 1] + List[i - 2]) | ||
|
||
return (List[0:n]) | ||
|
||
|
||
if __name__ == '__main__': | ||
n = int(input()) | ||
print(list(map(cube, fibonacci(n)))) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
regex_pattern = r'[.,]+' | ||
|
||
import re | ||
|
||
print("\n".join(re.split(regex_pattern, input()))) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
def fun(email): | ||
try: | ||
username, url = email.split('@') | ||
website, extension = url.split('.') | ||
except ValueError: | ||
return False | ||
|
||
if username.replace('-', '').replace('_', '').isalnum() is False: | ||
return False | ||
elif website.isalnum() is False: | ||
return False | ||
elif len(extension) > 3: | ||
return False | ||
else: | ||
return True | ||
|
||
|
||
def filter_mail(emails): | ||
return list(filter(fun, emails)) | ||
|
||
|
||
if __name__ == '__main__': | ||
n = int(input()) | ||
emails = [] | ||
for _ in range(n): | ||
emails.append(input()) | ||
|
||
filtered_emails = filter_mail(emails) | ||
filtered_emails.sort() | ||
print(filtered_emails) |