![]() Instead of if answer = "y" or answer = "Y":, use if answer in. You can make use of "".join() in Function1(), to clean up the code. This goes for your other functions too: RunType2() and especially Function1() are really bad names. As it is, looking at your code, I wouldn't understand what the name had to do with the actual code. Your function RunFun() should have a more descriptive name. You can use the string module instead of manually typing a, b, c / A, B, C / 1, 2, 3 etc. I use Python 3, so I am unsure if all of these suggestions apply to Python 2. RunType2(1,3) #hands over values 1 and 3, opts out 4 RunType2(1,4) #hands over value 1 and 4 to include #requests user input which determines if special charactersĪnswer = raw_input("Can it have special characters? Y for yes "n","o","p","q","r","s","t","u","v","w","x","y","z"]ĭashes = raw_input("Would you like it to be seperated into"įour sections of four characters divided by a dash? # if response is yes and only yes, characters is # if type=2 lower is added to objects list # if type=1 upper is added to objects list if type=0 number value is added to objects list # assign randint between 0-9 to character var Var, assign randint between 0-9 to number var, assign randint between 0 and 25 to lowercase and uppercase # come up with random number between 1 and 4, set = to var come up with random number between 1 and 3, set = to var ask for user input if special characters can be added and set #loop goes through steps until user decides to quit Password which has no certain pattern to it #sections by a dash as well as a more secure and better created The option for the password to be separated into #version 2 introduces option to include special characters and Such as how random this password is, any syntax errors, or any ways to simplify my code. Since I am still new, I would like to receive advice and any thoughts on how to improve my code as well as a programmer. I created a simpler project and I decided to build upon it to create version 2. It basically creates a password made up of numbers, capital and lower case letters with the option to include special characters and dashes. This is my second program written in python. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |