Skip to content

Instantly share code, notes, and snippets.

@josifoski
Created February 7, 2018 00:10
Show Gist options
  • Save josifoski/da4d749a1928258e4770176dcba7f468 to your computer and use it in GitHub Desktop.
Save josifoski/da4d749a1928258e4770176dcba7f468 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python3.5
# Script for hiding text, exposing only mid letter(s), or outer letters
# Aleksandar J. https://about.me/josifsk, thinking on current twitterverse sent by https://twitter.com/tarynsouthern
# 2018 January 28; February 7
from math import trunc
bmid = False # True for exposing mid letter(s), False for outer
intext = '''For this is the will of God: your sanctification, that you abstain from sexual immorality,
'''
# 1.The_ 4:3 World English Bible
subletter = '♡'
li = intext.split()
lo = []
# mid letter(s)
for word in li:
#word = word.strip('.,;?!:"„“')
mid = trunc(len(word) / 2)
if len(word) < 3:
lo.append(word)
elif len(word) % 2 == 0:
if bmid:
lo.append(subletter * len(word[:mid - 1]) + word[mid -1:mid + 1] + subletter * len(word[mid + 1:]))
else:
lo.append(word[:mid -1] + subletter * 2 + word[mid + 1:])
else:
if bmid:
lo.append(subletter * len(word[:mid]) + word[mid] + subletter * len(word[mid + 1:]))
else:
lo.append(word[:mid] + subletter + word[mid + 1:])
output = ' '.join(lo)
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment