Really small en/decode program written in python

03/09/2014 20:48 newchild#1
Yes I know this is not a masterpiece of codes(It is full of bugs, has ugly namings and an unproper use of Object-oriented programming) but it still can be useful as a bad example.
Code:
class encode(object):
    def __init__(self,list=[],real_list=[]):
        self.list=list
        self.real_list=real_list



    def stringtofloat(self,string):
        if string.lower()=='a':
            self.l=1*self.key
        if string.lower()=='b':
            self.l=2*self.key
        if string.lower()=='c':
            self.l=3*self.key
        if string.lower()=='d':
            self.l=4*self.key
        if string.lower()=='e':
            self.l=5*self.key
        if string.lower()=='f':
            self.l=6*self.key
        if string.lower()=='g':
            self.l=7*self.key
        if string.lower()=='h':
            self.l=8*self.key
        if string.lower()=='i':
            self.l=9*self.key
        if string.lower()=='j':
            self.l=10*self.key
        if string.lower()=='k':
            self.l=11*self.key
        if string.lower()=='l':
           self.l=12*self.key
        if string.lower()=='m':
            self.l=13*self.key
        if string.lower()=='n':
            self.l=14*self.key
        if string.lower()=='o':
            self.l=15*self.key
        if string.lower()=='p':
            self.l=16*self.key
        if string.lower()=='q':
            self.l=17*self.key
        if string.lower()=='r':
           self.l=18*self.key
        if string.lower()=='s':
            self.l=19*self.key
        if string.lower()=='t':
            self.l=20*self.key
        if string.lower()=='u':
            self.l=21*self.key
        if string.lower()=='v':
            self.l=22*self.key
        if string.lower()=='w':
            self.l=23*self.key
        if string.lower()=='x':
            self.l=24*self.key
        if string.lower()=='y':
            self.l=25*self.key
        if string.lower()=='z':
            self.l=26*self.key
        self.list+=[self.l]

    def encode(self):
        text=input('text')
        self.key=int(input('key(numbers only)'))
        for i in range(len(text)):
            self.stringtofloat(text[i])
            helpervar=self.list[i]
            self.real_list+=[helpervar]
        print(self.list)

class decode(object):
    def __init__(self,string='',real_string=''):
        self.string=string
        self.real_string=real_string

    def floattostring(self,float):
        if float==0:
            self.l=' '
        if float==1:
            self.l='A'
        if float==2:
            self.l='B'
        if float==3:
            self.l='C'
        if float==4:
            self.l='D'
        if float==5:
            self.l='E'
        if float==6:
            self.l='F'
        if float==7:
            self.l='G'
        if float==8:
            self.l='H'
        if float==9:
            self.l='I'
        if float==10:
            self.l='J'
        if float==11:
            self.l='K'
        if float==12:
            self.l='L'
        if float==13:
            self.l='M'
        if float==14:
            self.l='N'
        if float==15:
            self.l='O'
        if float==16:
            self.l='P'
        if float==17:
            self.l='Q'
        if float==18:
            self.l='R'
        if float==19:
            self.l='S'
        if float==20:
            self.l='T'
        if float==21:
            self.l='U'
        if float==22:
            self.l='V'
        if float==23:
            self.l='W'
        if float==24:
            self.l='X'
        if float==25:
            self.l='Y'
        if float==26:
            self.l='Z'
        self.string+=self.l

    def decode(self,text=[]):
        counter=int(input('Number of numbers(lol)'))
        for x in range(counter):
            local_string=str(x+1)+'Number'
            text+=[input(local_string)]
        self.key=int(input('key(numbers only)'))
        for i in range(len(text)):
            self.floattostring(float(text[i])//self.key)
            helpervar=self.string[i]
            self.real_string+=helpervar
        print(self.real_string)
So you might want to have a look at this :)
04/20/2014 09:02 LovecKrys#2
Here you should write text = str(input('text')) instead of text=input('text'), then it's not needed to write the input text int "" xD