#!/usr/bin/env python #get the username from a prompt username = raw_input("Login: >> ") #list of allowed users user1 = "Jack" user2 = "Jill" #control that the user belongs to the list of allowed users if username == user1: print "Access granted" elif username == user2: print "Welcome to the system" else: print "Access denied"
Share this article
Recommended Python Training – DataCamp
For Python training, our top recommendation is DataCamp.
Datacamp provides online interactive courses that combine interactive coding challenges with videos from top instructors in the field.
Datacamp has beginner to advanced Python training that programmers of all levels benefit from.
Read more about: