develop a program which asks for a name and a password,and prints an acceptance message if the name is "aladdin" and the password is "sesane".the program should print a reject message in all other cases.this should be achived by combining the two tests into one using the "and"key word

#! /usr/bin/env python

def verify(username, password):
    if username == "aladdin" and password == "sesane":
        return True
    else:
        return False

username = raw_input("Enter username: ")
password = raw_input("Enter password: ")
result = verify(username, password)

if result:
    pass
else:
    print("Invalid input.")

Although it could probably be done much better by a more experienced programmer.

Edited 3 Years Ago by farmwife

vega, I think that was an exercise rather than practical application. It has zero practical value because the script is ascii! :)

This question has already been answered. Start a new discussion instead.