سيطلب هذا البرنامج النصي من المستخدم اسم المستخدم الخاص به ، باستخدام وظيفة raw_input. ثم يتم إنشاء قائمة بالمستخدمين المسموح لهم باسم user1 و user2. يتحقق بيان التحكم مما إذا كان الإدخال من المستخدم يطابق تلك الموجودة في قائمة المستخدمين المسموح لهم.
#!/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"
Code language: PHP (php)