Commit 5cf7a6ea authored by Børge Haugset's avatar Børge Haugset
Browse files

halvvveis

parent 2a296546
......@@ -15,7 +15,7 @@ def addSite(notebook):
notebook = {'facebook': ['urgle', ['pwd','newpass']], \
'vgeretfrykteligkortnavn': ['user', ['pwd2']], \
'db': ['nah', ['pwd']]}
'db': ['nah', ['pwd222']]}
def showSites(notebook):
print(f"{'Nettsted:':17}{'Brukernavn:':15}{'Passord:'}")
......@@ -39,4 +39,26 @@ def editSite(notebook, site):
notebook[site][1].append(password)
return notebook
editSite(notebook, 'facebook')
\ No newline at end of file
#editSite(notebook, 'facebook')
def secureSites(notebook):
passFrequency = {}
for site, val in notebook.items():
lastpass = val[-1][-1]
usedinsites = passFrequency.get(lastpass, [])
usedinsites.append(site)
passFrequency[lastpass] = usedinsites
allUnique = True
for password, sites in passFrequency.items():
if len(sites) > 1:
print(f'You have used {password} at these sites: {formatList(sites)}.')
allUnique = False
if allUnique:
print("Du er så flink atter!")
secureSites(notebook)
\ No newline at end of file
noe = [1,2,3]
def fiks(noe):
noe[2] = 'tolv'
fiks(noe)
print(noe)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment