Pages

All about computer science from Assebly to Python3.0 ...

1.23.2012

This is RE(regular expression) basic program in python.
The idea came to me while i was working on a school assignment.
All it dose is that it creats from the input a list of numbers.

example:
hfag4g2g5lb6b2 -> re scanner - > output: [4,2,51,6,2]
 
- the program scanns for all number within the input and creates a list out of them. It is changeable to file I/O.




CODE:


import re


def listC():
        """RE input scanner"""
        inp =raw_input('insert the string/list of numbers: ')
        L = re.findall(r'\d+', inp)
        l=[]
        for i in range(len(L)):
            l.append(int(L[i]))
       
        def bbSort(l):
            """bassic  uble sort algorithm implemented in python""" 
            sw = True 
            while sw: 
                sw = False 
                for i in range(len(l)-1):
                    if l[i] > l[i+1]: 
                        l[i], l[i+1] = l[i+1], l[i] 
                        sw = True 
            print l 
       
       
        bbSort(l)

11.28.2011

Hello again,
considering python is getting more important everyday, many computer scientists started to develop their skills in python enviorment.

That is why i started to make a basic data collection of ebooks, tutorials and the source code of different programs.

You can find imore details here, or on the navigation bar in 'Python' tab.

11.27.2011