# # python/examples/ValIntStr1.py # # Examples of the functions int, and str # (I thought that a function val existed that returned the values of the string characters def bin2dec(a): """ Convert a string (a) to decimal >> bin2dec('1001') 9 """ answer=0 for x in val(a): answer = answer * 2 answer += x return answer # Example by David MacKay www.aims.ac.za/~mackay/