glitch random number python script

import sys

args = sys.argv
txt = open(args[1], 'r')

words = txt.readlines()

prevletter = 'a'
number = [0,0,0,0,0,0,0,0]
numberCount = 0


for line in words:
	for letter in line:
		if letter.isalpha():
			letter = letter.lower()
			if ord(letter) < ord(prevletter):
				number[numberCount] = 1
			elif ord(letter) > ord(prevletter):
				number[numberCount] = 0
			prevletter = letter
			if numberCount == 7:
				if len(number) == 8:
					print number[0]*128+number[1]*64+number[2]*32+number[3]*16+number[4]*8+number[5]*4+number[6]*2+number[7]*1
				numberCount = 0
			else:
				numberCount += 1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s