EX: abababababaaaa
would out put
a b
a 3 5
b 5 0
this is what I have so far, I need to use lists not strings that is my first problem with my code, and help would be appreciated
import sys if len(sys.argv) != 2: print "usage: python", sys.argv[0], "filename" sys.exit(1) f = open(sys.argv[1], "r") line = f.read() f.close() char = "" count = 0 letters = [] i = 0 for x in line.rstrip(): if (x in letters): count = count else: count += 1 letters.append(x) print count, " ", letters
This post has been edited by labradorguy: 12 October 2011 - 03:45 PM

New Topic/Question
Reply



MultiQuote







|