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

Swiss
miss
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)

Cat program

thread
spread
lead
print(input())

A+B Problem

glass
mass
class
a = int(input())
witch
stitch
pitch
b = int(input())
corn
horn
worn
print(a + b)

Quine(?)

truck
pluck
duck
f="truck\npluck\nduck\nf={!r}\nsus\nbus\nclues\nprint(code.format(code))"
sus
bus
clues
print(f.format(f))

Judge even(if-statement needed)

stuck
struck
luck
f = int(input())
idxxxx
idyyyy
idzzzz
if f % 2 == 0:
    his
    this
    Swiss
    print("Even")
missed
spilled
tried
else: # exhausted(negative word)
    corn
    horn
    worn
    print("Odd")

Self-interpreter

truck
pluck
duck
f=exec((p:=open("program.txt").read().split("\n"),"\n".join([p[i] for i in range(3,len(p),4)]))[1])

Usage of Chinese

青丝
游丝
螺丝
def greet(username = 'guest'): # 屌(diao3)丝
    一股
    合股
    引锥刺股
    print(f"Hello, {username}!") # 屁(pi4)股
房门
开门
入门
greet("Mihai Popa") # 肛(gang1)门

Python(Pyline) interpreter

Assuming the program is stored in program.txt,

exec((p:=open("program.txt").read().split("\n"),"\n".join([p[i] for i in range(3,len(p),4)]))[1])

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
print(yaya)
1
2
3
y = 3

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