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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.