Fun 2 code

From Esolang
Jump to navigation Jump to search

Fun 2 code is a modification of Python where its like Fun 2 rhyme, a trendy song by Howard Moody.

How it works

First, you think up a swear word the first letter of the python command. Then, you write down 3 words that rhyme with it, seperated by new lines, and then the command.

Hello World

sis
diss
this
print("hello world")

Truth machine

truck
duck
pluck
f = int(input())
this
list
quiz
print(f)
tank
bank
rank
while f==1:
    trick
    flick
    kick
    print(f)     

Python interpreter

Assuming the program is stored in program.txt,

program = open("program.txt", "r")
program = program.read()
things = program.split('''
''')
code=""
i = int(len(things)/4)
count = 0
while i!=0:
  j=4
  while j!=0:
    count+=1
    j-=1
    if (count+1)%4==0:
      code+='''
'''+things[count]
  i-=1
exec(code)

Replace the exec at the end with print and you have a transpiler.

Note that this does not enforce rhyme schemes, so you could make a program like this:

1
2
3
4
print(yaya)
1
2
3
4
y = 3

And the interpreter would not get mad at you. These are not accepted as official programs.