from typing import Text
def bubbleSort(arr):
n = len(arr)
for i in range(n):
for j in range(n-1):
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
return arr
arquivo = open(r’C:\Users\maiks\Desktop\prova3b\emails.txt’)
email = arquivo.readlines()
print(email)
lista = bubbleSort(email)
print(lista)
hotmail = ‘hotmail’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(hotmail)
print(‘O Hotmail possui:’, ocorrencias)
gmail = ‘gmail’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(gmail)
print(‘O Gmail possui:’, ocorrencias )
yahoo = ‘yahoo’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(yahoo)
print(‘O Yahoo possui:’, ocorrencias )
bol = ‘bol’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(bol)
print(‘O Bol possui:’, ocorrencias )
pandora = ‘pandora’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(pandora)
print(‘A Pandora possui:’, ocorrencias )
walla = ‘walla’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(walla)
print(‘A Walla possui:’, ocorrencias )
fdsb = ‘fdsb’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(fdsb)
print(‘O Fdsb possui:’, ocorrencias )
zipmail = ‘zipmail’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(zipmail)
print(‘O Zipmail possui:’, ocorrencias )
mississippi = ‘mississippi’
with open(‘emails.txt’) as f:
ocorrencias = f.read().count(mississippi)
print(‘O Mississippi possui:’, ocorrencias )
with open(‘txt.txt’,‘w’) as arquivo:
for valor in email:
arquivo.write(str.lower(valor))