New user working through riddles
Hey, I am somewhat new to Python programming, and I felt like these riddles are good challenges to get some practice, but I seem to be having trouble with a piece of code I wrote to try and find the rarest characters in a huge list. Now as far as I can see, it should work. (but then again, I'm new at this. ) If you could take a look at it and give me any suggestions. Thanks
#Function to remove characters from a string
def remove(str, char):
alist= str.split()
while char in alist:
alist.remove(char)
str=''.join(alist)
return str
dct={}
code=raw_input('Input Code ->')
num=int(len(code))
while num > 0:
a=min(code)
b=code.count(a)
dct[a]=b
code= remove(code,a)
num=int(len(code))
print dct
#Function to remove characters from a string
def remove(str, char):
alist= str.split()
while char in alist:
alist.remove(char)
str=''.join(alist)
return str
dct={}
code=raw_input('Input Code ->')
num=int(len(code))
while num > 0:
a=min(code)
b=code.count(a)
dct[a]=b
code= remove(code,a)
num=int(len(code))
print dct

