Using dictionary to login - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Using dictionary to login (/thread-7616.html) |
Using dictionary to login - captainflint - Jan-17-2018 I need a help because of my project.I have 2 usernames and 2 passwords.But ı can not combine them.Also, I'm new so, ı have to use elemantry or basic codes. please help me :) this code give error why ?? notice: ahmet is username and its's password is sehir123 meryem is other username and it's password is 4444 message="***Welcome to Sehir Online Market***" message2="Please log in by providing your user credentials:" print message,('\n'),message2 database={['ahmet']=='sehir123',['meryem']=='4444'} name=raw_input('Username: ') ask=raw_input('Password: ') while True: if ask in database: print "Succesfully logged in!" else: print "Your user name and/or password is not correct. Please try again!" break RE: Using dictionary to login - micseydel - Jan-17-2018 I think there's a misconception here...
RE: Using dictionary to login - captainflint - Jan-18-2018 thank you very much bro. :) Question: When main menu item 1 is chosen, the user will be asked to provide search term(s). Then, your program will display a list of all items from inventory whose name includes the user-provided search term(s), and whose stock amount is greater than 0. For instance, when the user searches for “Juice”, the program should display all items whose name includes ‘juice’ and available in the stocks as follows. Product name checking should be case insensitive (i.e., you should not differentiate between lower and upper case letters). How ı will do it likely: Please choose one of the following Services: 1. Search for a product 2. See Basket 3. Check Out 4. Logout 5. Exit Your Choice: 1 What are you searching for? Juice found 3 similar items: 1.grape juice $9 2.orange juice $8 3.apple juice $7 Please select which item you want to add to your basket (Enter 0 for main menu): How ı do it? ı tried but ı can't do it.. |