My first Python Program

So This week I finally got a good solid chance to block out some time to start learning python. I’ve been meaning to for quite some time, but with work, and other projects, it seems to always get bumped down my list. As usual when I set out to learn something, I pick a project that I’ve done before in another Language so that I understand the logic and its just about learning the syntax.

I’d like to start by saying, now that I’ve started, I DON’T WANT TO PROGRAM IN ANYTHING ELSE!!!! python is freaking awesome.

Okay, now that’s out of my system, I’m going to write about my program (and haters can hate, and tell me there are better ways to do it.. I know there are… this is my first one). I decided I was going to write a random password generator. As anyone who has talked to me before will know, I freaking love passwords. I love making good ones, I love Stealing them from others, and I love breaking them. But my intro into any programming language C (which i hated and never continued) VB (loved it because I could do a lot, and it let me be lazy) and recently AutoIT (windows scripting we use at work) I have always written a password generator.

I like to make it customizable to some point, because everyone has different things they like or don’t like in passwords. Since this was my first version, I made it the way I Like… thats right, SCREW YOU GUYS I”M GOING HOME! anyway, I wanted to include all uppercase, lowercase, numerics, and symbols as a possible character for my password. So I started looking at books, and read about Strings.

first line: Char_pool=”abcdefghijklmnopqrstvuwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_+-={}[]:|?<>” #UGH PAINFUL
So I had my working character pool, and would work on finding easier ways to do that later. but now I needed to get input from the user to know how LONG the password needed to be.
passLen=raw_input(“how long would you like your password? “), only problem? raw_input stores the value as a string, so you cant loop ’20’ times… it just doesn’t work.

As anyone will tell you, learning syntax is a pain especially after you’ve been fluent in other languages simply because your mind already likes to solve the problem a specific way. So I kept diving through on-line resources, and bugging my friends about what I was doing wrong. (Giant shout outs to Keith and Phil, @k3170Makan & @Grap3_Ap3 respectively for all their help)

And now I’m proud to present My first Python Program: passgen_source
and on pastebin: here

*removed paste of source, because it removed indents*

 

Advertisements

3 responses to “My first Python Program

  1. Pingback: Updated passgen.py | DarkLordZim's Blog

  2. Lulz. Why did you have to stop C? That what am currently learning and it’s damn interesting. Nice article though, and does the password generator really work?

    • I don’t program in C strictly because its time prohibative. I work between 40-60hrs a week, have to spend quality time with the family, and still manage to squeeze in some hacking and scripting. C is one of those things that at this point, I just don’t have time for, not that I never will.