- Sep 5, 2017
- 1,173
hi guys ,
i am beginner in programming but while learning statement/loops/lists in python i coded simple code to check user name/password against stored one as you could see below:
although it still very very simple but i am feeling happy to accomplish something while (not loop) i am learning:
really i know i this is very basic but i am feeling happy
i think this may be linking with back end database of course with some code scalability to be more dynamic
so Guys what is your opinion ?? i am happy to know your feedback
Note:this code is written in python language
i am beginner in programming but while learning statement/loops/lists in python i coded simple code to check user name/password against stored one as you could see below:
although it still very very simple but i am feeling happy to accomplish something while (not loop) i am learning:
Python:
User_names_database = ['user_name']
password_database = ['0123456']
"""prompt user to enter his/her username"""
entered_user_name = input("Please enter the user name:")
entered_user_name.title()
entered_password = input("please enter your password:")
"""Check if the entered user name/password existing in the user data base of the website"""
if entered_user_name == 'user_name' and entered_password == '0123456':
print('login Successful,you will be shortly redirected to your account page')
else:
print('login fail,please try again\nif you cannot remember you should choose forget password below')
while True:
entered_user_name = input("Please enter the user name:")
entered_user_name.title()
entered_password = input("please enter your password:")
if entered_user_name == ' user_name' and entered_password == '0123456':
print('login Successful,you will be shortly redirected to your account page')
really i know i this is very basic but i am feeling happy
i think this may be linking with back end database of course with some code scalability to be more dynamic
so Guys what is your opinion ?? i am happy to know your feedback
Note:this code is written in python language