diff --git a/week7_1.py b/week7_1.py new file mode 100644 index 0000000..39d5226 --- /dev/null +++ b/week7_1.py @@ -0,0 +1,23 @@ +print('*'*21) + +'''Write a program that detects the ID number hidden in a text. We know that the format of the ID number is 2 letters, 1 digit, 2 letters, 2 digits, 1 letter, 1 digit (For example: AA4ZA11B1). +Input : AABZA1111AEGTV5YH678MK4FM53B6 Output : MK4FM53B6 +Input : AEGTV5VZ4PF94B6YH678 Output : VZ4PF94B6''' + +import re #RegEx import edilir + +id_find=input('Enter the txt: ') #enter text + +patern=r"\w{2}\d\w{2}\d{2}\w\d" #patern created.two character, one digit two char.two digit,one char,one digit + +for match_find in re.findall(patern,(id_find.upper())):#assigment to match_find + print(match_find) + + +################################################# +print() # +a="Sharp" # +print(('*'*(50)).center(50)) # +print(f'Look {a}, Act {a}, Be {a}'.center(15)) # +print('E.Cinar.'.center(60)) # +################################################# \ No newline at end of file diff --git a/week7_2.py b/week7_2.py new file mode 100644 index 0000000..6f5a000 --- /dev/null +++ b/week7_2.py @@ -0,0 +1,17 @@ + '''Find words that are 8 letter long on this text ;''' + +import re +with open('letter8.txt','r') as let_8: #open file with read mode. and assigmented let_8 + type=let_8.read() + patern=r"\w{8}" #creaated patern + for result in re.findall(patern,type): + print(f'{result}') + + +################################################# +print() # +a="Sharp" # +print(('*'*(50)).center(50)) # +print(f'Look {a}, Act {a}, Be {a}'.center(15)) # +print('E.Cinar.'.center(60)) # +################################################# \ No newline at end of file diff --git a/week7_3.py b/week7_3.py new file mode 100644 index 0000000..221bf68 --- /dev/null +++ b/week7_3.py @@ -0,0 +1,25 @@ +'''Write a program that list according to email addresses without email domains in a text. +Example: +Input :The advencements in biomarine studies franky@google.com with the investments necessary and Davos sinatra123@yahoo.com. + Then New Yorker article on wind farms... +Output : franky sinatra123''' + +import re #RegEx import edilir + +et='The advencements in biomarine studies franky@google.com with the investments necessary and Davos sinatra123@yahoo.com.' + +patern=r"\w+[@]" #karakter ile baslayan ve @ ile biten patern olusturulur. +nummer=0 #bulunan sonuclari numaralandirmak icin; +for i in re.findall(patern,et): #findall methodu ile bulunan string i atanir + nummer+=1 + i=i.strip('@') #stringde bulunan @ karakteri strip kullanilarak cikartilir + print(f'{nummer}.{i}') + + +################################################# +print() # +a="Sharp" # +print(('*'*(50)).center(50)) # +print(f'Look {a}, Act {a}, Be {a}'.center(15)) # +print('E.Cinar.'.center(60)) # +################################################# \ No newline at end of file