![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Jul 2004
Location: Location
Posts: 140
Rep Power: 5
![]() |
[Python] Password Generator
Just a basic password generator that I did while programming python yesterday. It actually works ok. (Maybe I should try mixing letters and numbers next)
#This program generates a random password based on numbers
#Copyright Bulio, 2006'''
import random
print "Welcome to the random password generator"
print "Make a choice to continue."
while True:
choice = raw_input("1.Generate a password\n2.Exit\n") # Get user input
if choice == "1":
try:
length = raw_input("Enter the length of your password now, with a minimum of 8 digits: ")
pword = random.randint(30000,length) #Generate the random password now
print "Your password recommended password is: ", pword #Print the random password
break
except ValueError:
print "Not a real number. Please enter another."
elif choice == "2":
print "Quitting now"
break
else:
print "Invalid choice. Please type either 1 or 2.\n"
continue |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
Good job. If you plan on doing letters next, be sure to check out the chr() function (if you weren't already aware of it). Just by the way, your 'continue' is unecessary. It would work just the same without it.
Nice work. Now for some fancy graphics. :banana: |
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Nicely done, I can understand most Python code, though I know nothing of it and have never touched it.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|