Skip to content

Commit

Permalink
Another wave is completed
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonePY committed Apr 12, 2023
1 parent 7def3aa commit 6561f25
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 0 deletions.
15 changes: 15 additions & 0 deletions SixteenthWave/detectFloating.py
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()
5 changes: 5 additions & 0 deletions SixteenthWave/groups.py
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)
14 changes: 14 additions & 0 deletions SixteenthWave/mapLambda.py
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))))
5 changes: 5 additions & 0 deletions SixteenthWave/reSplit.py
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())))
30 changes: 30 additions & 0 deletions SixteenthWave/validateEmailfilter.py
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)

0 comments on commit 6561f25

Please sign in to comment.