Skip to content

Instantly share code, notes, and snippets.

@Torxed
Last active March 25, 2016 20:03
Show Gist options
  • Save Torxed/56098612df43cfdf39c7 to your computer and use it in GitHub Desktop.
Save Torxed/56098612df43cfdf39c7 to your computer and use it in GitHub Desktop.
simple login example
#Definerer databasene og
database = {'Andreas' : 'Password1',
'Andy' : 'Password2'}
#Definerer funksjonene
def godkjent():
print ('Halla ' +bruker)
def ikkegodkjent():
print ('Beklager ' +bruker+ ', du har ikke tilgang her')
#Spør etter brukernavn og passord
print ('Hallo, og velkommen')
print ('Vennligst skriv inn dina inloggningsuppgifter')
bruker = input('Username: ')
passord = input('Password: ')
if bruker in database and database[bruker] == passord:
godkjent()
else:
ikkegodkjent()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment