Text Scrambler

This program demonstrates an interesting phenomenon regarding reading. It shows, that we are not reading letter by letter, but rather word by word.
Taht is why you can mkae snsee of this sennetce.

A scrambled text

# Python 2.7.7 Code
# Jonathan Frech 6th of September, 2015
#        edited 18th of September, 2015

# import modules
import random, re

# get input
TXT = raw_input("text: ")
STR = ""

for txt in re.split(" +", TXT):
	# process
	if len(txt) > 2:
		letters = []
		for _ in txt[1:len(txt)-1]:
		_txt = ""
		for _ in range(0, len(txt)-2):
			r = random.randint(0, len(letters)-1)
			_txt += letters[r]
		STR += txt[0] + _txt + txt[len(txt)-1] + " "
		STR += txt + " "

# output
print STR

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.