Amount of letters in a inputted string? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Amount of letters in a inputted string? (/thread-3279.html) |
Amount of letters in a inputted string? - CyanSupreme - May-10-2017 I'm not sure how to make it so that if the password has less than 5 letters, it says Please select a longer password! password = input("Please enter a password. ") import time time.sleep(0.3) if password <= len int(5): password2long = input("Please select a longer password ") else : verifypassword = input("Please confirm your password. ") RE: Amount of letters in a inputted string? - Mekire - May-10-2017 if len(password) <= 5:Also you will probably want to wrap some of this in a while loop so it continues to ask on faulty input rather than just ends. RE: Amount of letters in a inputted string? - buran - May-10-2017 if len(password) < 5:and why on Earth you should use time.sleep() ? Not that user will really notice 0.3 sec pause
RE: Amount of letters in a inputted string? - nilamo - May-10-2017 Instead of input , you should probably use getpass , so whatever they type doesn't get displayed on the screen: https://docs.python.org/3.6/library/getpass.html
|