CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2002
    Location
    Singapore
    Posts
    673

    Wink Any interesting Python programs you have written?

    I haven't written any. I was tasked last year to teach an intern to do some inhouse programs using Python. That time, I was just learning Python before I mentored the intern.

    I found Python likable as it is really easy to do tasks.

    Tell me any interesting programs you have written so far.

  2. #2
    Join Date
    Mar 2008
    Posts
    5

    Re: Any interesting Python programs you have written?

    Years ago I wrote a program in AMOS basic on the Amiga for jazz guitarists which, among many other things, thoroughly analyzed chord shapes that you gave it. Without going into it too much, the code for that took me nearly a week in AMOS. I didn't program anything else for nearly 10 years and recently picked up Python. Toying with the idea of writing the program again, I started playing with some code to analyze chord notes in the same way. It was finished in 3 hours. I was almost disappointed at how easy it was in comparison.

  3. #3
    Join Date
    Apr 2008
    Posts
    6

    Re: Any interesting Python programs you have written?

    Here is my simple python program, ummm ...., interesting!
    Code:
        # aa.py
    
        import sys
    
        fontMap = "111001001110111010101110111011101110111|101011000010001010101000100000101010101|101001001110011011101110111000101110111|101001001000001000100010101000101010001|111011101110111000101110111000101110111".split('|')
    
        W=4
    
        if len(sys.argv) != 2:
           print "Usage\n\taa.py <number>"
           sys.exit(1)
        else:
           number = sys.argv[1]
    
    
        for row in fontMap:
           line = ''
           for d in number:
              if d not in '0123456789':
                 print 'Error: Only digits allowed!'
                 sys.exit(1)
              i1 = int(d) * W
              i2 = i1 + W
              line += row[i1:i2]
              if d == '9': line += ' '
           line = line.replace('0', ' ')
           line = line.replace('1', '@')
           print line
    
        sys.exit(0)

  4. #4
    Join Date
    Jun 2008
    Posts
    4

    Re: Any interesting Python programs you have written?

    I've worked on a lot of automata related programs with Python: bottom-up parsers, top-down parsers, cellular automata demonstrations, DFA and NFA abstractions--oh yeah, and regular expressions, which Python is very well-suited for. I've also worked on 3d armature exporters and 2d games as well, which is a testament to how versatile the language can be.

  5. #5
    Join Date
    Sep 2010
    Posts
    1

    Re: Any interesting Python programs you have written?

    wow I have done anything cool as you guys...

    but I wrote a script for fun just to covert any sentence into 1337 speak =D. I thought it was fun and I learned quite a bit from it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured