text:
Be as fair as possible
Introduction
In this challenge you should split an integer into two pieces. Since nobody likes getting the smaller piece of cake, your goal is to be as fair as possible. For example if you wanted to split the integer 7129 into two pieces, there are 3 possible ways of doing so.
7,129, 71,29 and 712,9 are all possibilities, but 71,29 is the fairest way of splitting it into two pieces because it minimizes the difference between the two:
7 129 -> |7-129| = 122
71 29 -> |71-29| = 42
712 9 -> |712-9| = 703

Challenge
Given an integer determine the best possible way of partitioning it as described above and report the resulting difference.
Rules

Splitting only makes sense for integers of length at least two, the input will always be ≥ 10
Input can be either an integer, list of digits or a string
You don't have to handle invalid input

Testcases
You only need to report the resulting difference, the partitioning is only here for illustration:
10 -> 1,0 -> 1
11 -> 1,1 -> 0
12 -> 1,2 -> 1
13 -> 1,3 -> 2
101 -> 1,01 -> 0
128 -> 12,8 -> 4
313 -> 3,13 -> 10
1003 -> 1,003 -> 2
7129 -> 71,29 -> 42
81128 -> 81,128 -> 47
999999 -> 999,999 -> 0
9999999 -> 999,9999 or 9999,999 -> 9000

Brachylog, 12 11 bytes
My first Brachylog answer
Take input as a string
{~cĊịᵐ-ȧ}ᶠ⌋

Try it online!
Explanation:
ᶠ will find all possible outputs for the predicate in {…} and store them in a list. ~c says that the output is a list that, when concatenated, is equal to the input. Next Ċ asserts that the the output of ~c has length 2.
ịᵐ converts both elements of the output into integers (this gets rid of leading 0s), -ȧ takes the absolute difference of the two elements.
Once we have our list of all possible outputs, we get the minimum element with ⌋

05AB1E, 9 bytes
Code:
ā¤âε£ÆÄ}W

Uses the 05AB1E encoding. Try it online!
Explanation
ā            # Get the array [1, 2, .., len(input)]
 ¤â          # Cartesian product with the last element, (e.g. for input 12345:
               [[1, 5], [2, 5], [3, 5], [4, 5], [5, 5]])
   ε   }     # For each element:
    £        #   Get the substrings (12345 [3, 5] £ --> [123, 45])
     Æ       #   Reduce by subtraction
      Ä      #   Get the absolute value
        W    # Take the minimum of all results

If you replace £ with °‰ you won't need ¤â anymore.

@Emigna And then you also don't need the ε/} anymore: ā°‰ÆÄW - 6 bytes.

Haskell, 48 bytes
f n=minimum[abs$n`div`10^k-n`mod`10^k|k<-[1..n]]

[1..n] makes this too slow for the larger test cases.
Try it online!

Nice job! I got so blind sided by using strings that I forgot that I could use arithmetic.

Python 2, 64 bytes
lambda n:min(abs(int(n[i:])-int(n[:i]))for i in range(1,len(n)))

Try it online!

Perl 6, 40 bytes
{min map {abs [-] @$_},m:ex/^(.+)(.+)$/}

Test it
Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  min
    map
      {
        abs
          [-]    # reduce with &infix:«-»
            @$_  # the input of this inner block as a Positional
      },

      # split ｢$_｣ into 2 in every possible way
      m
      :exhaustive
      /^ (.+) (.+) $/
}

Prolog (SWI), 195 189 154 117 112 bytes
35 bytes saved thanks to Eminga
A*H:-findall(X,(between(0,A,I),r(A,I,X)),L),sort(L,[H|_]),!.
r(A,B,C):-Z is 10**B,divmod(A,Z,X,Y),C is abs(X-Y).

Try it online!
This is my first try at prolog golfing so it may be a bit horrendous.  Here is how it works.
At the highest level we have *.  * takes A and H, and determines if H is the smallest way to split A.
    A*H:-
      findall(X,(between(0,A,I),call(r,A,I,X)),L),
      sort(L,[H|_]),
      !.

The first line here uses a technique from this SO post, to essentially perform a map of the predicate r(A) over the integers from 0 to A.  Since r confirms the values of each partitions this will give us the values of all possible partitions, plus a whole load of extra junk.  All these partitions will be stored in L in no particular order.  Once that is done we sort the list to find the smallest element.  We then use a cut to prevent backtracing.
Next we have the definition of r.
First r calculates the two results of the split naming them X and Y.
r(A,B,C):-
  Z is 10**B,
  divmod(A,Z,X,Y),
  C is abs(X-Y).

Then we assert that C is the difference of them and is positive.
  C is abs(X-Y).

There seem to be a misstake here as X is div(A,10**B),Y is div(A,10**B) will always give C=0 (meaning H will always be 0 as well). Should be Y is mod(A,10**B) I presume.

The second row could also be r(A,B,C):-Z is 10**B,divmod(A,Z,X,Y),C is abs(X-Y). saving 32 bytes (If you're using SWI prolog at least, not sure about other versions).

The first row could start with for example A*H instead of l(A,H) saving another 3. And if you are using SWI, you could add a TIO link

Also, I don't think you need the ,! do you? There shouldn't be any backtracking at that point.

@Emigna Thanks for the tips, I'll be implementing them shortly.  I also thought ,! would not be necessary but when I test the program it does backtrace.  It seems to try every possible ordering of L and then sorts them all.  Meaning it will give the same answer A! times.

C, 94 bytes
c,r,d,a;f(n){for(c=1,r=0,d=n<11?1:n;n;r+=n%10*c,c*=10,n/=10)a=abs(r-n),d=r&&a<d?a:d;return d;}

Try it online!

Python 2, 51 bytes
f=lambda n,k=1:min(abs(n/k-n%k),k/n*n or f(n,10*k))

Try it online!

Haskell, 68 65 bytes
f x=minimum[abs$read(take i x)-read(drop i x)|i<-[1..length x-1]]

Try it online!
Explanation
minimum              -- Minimum of ...
 [abs$               -- The absolute value of ...
  read(take i x)     -- The first i characters of x
  -                  -- Minus ...
   read(drop i x)    -- The last i characters of x
 |i<-[1..length x-1] -- From i=1 to i=length x - 1
 ]

Jelly, 9 8 bytes
ḌÐƤḊạḌƤṂ

Try it online!
-1 byte thanks to Dennis. Input is a list of digits.
Explanation
ḌÐƤḊạḌƤṂ
ḌÐƤ          Convert to integer from decimal for all Ƥostfixes. [1,2,3]->[123,23,3]
   Ḋ         Remove the first element ->[23,3]
     ḌƤ      Convert to integer from decimal for all Ƥrefixes [1,2,3]->[1,12,123]
    ạ        Absolute difference. [23,3]ạ[1,12,123]->[22,9,123]
       Ṃ     Minimum

Hm, your explanation doesn't seem to reflect what your code actually does.

@EriktheOutgolfer Is it the “remove the last element” part when it should say “remove the first element”? I’ll fix that, thanks for pointing it out

Charcoal, 14 bytes
Ｉ⌊Ｅθ↔⁻Ｉ…θκＩ✂θκ

Try it online! Link is to verbose version of code. Conveniently I get to use the 2-arg variant of Slice. Explanation:
   θ            Input string
  Ｅ             Map over characters
        θ   θ   Input string
         κ   κ  Current map index
       …        Mold to length (i.e. head)
           ✂    Slice (i.e. tail)
      Ｉ   Ｉ     Cast to integer
     ⁻          Subtract
    ↔           Absolute value
 ⌊              Minimum
Ｉ               Cast to string
                Implicitly print

APL (Dyalog), 27 bytes
{⌊/|-/⍎¨↑⊂∘⍵¨↓1,∘.=⍨⍳¯1+≢⍵}

Try it online!
How?
¯1+≢⍵ - length of n minus 1
∘.=⍨⍳ - identity matrix
      1,∘.=⍨⍳3
1 1 0 0
1 0 1 0
1 0 0 1

1, - prepend 1 for each row
↓ - split by rows
⊂∘⍵¨ - for each, partition the string by it
      1 0 1 0 ⊂ '7129'
┌──┬──┐
│71│29│
└──┴──┘

↑ - flatten
-/ - reduce each pair with subtraction
| - take absolute values
⌊/ - minimum

APL (Dyalog), 35 bytes
{⌊/|-/⍎¨(⊂∘⍵⍤1)1,∘.=⍨⍳¯1+≢⍵}

Try it online!

JavaScript (ES6), 64 bytes
Takes input as a string.
f=([c,...s],l=0)=>c?Math.min(Math.abs((l+=c)-s.join``),f(s,l)):l

Test cases

f=([c,...s],l=0)=>c?Math.min(Math.abs((l+=c)-s.join``),f(s,l)):l

console.log(f("10"     )) // -> 1
console.log(f("11"     )) // -> 0
console.log(f("12"     )) // -> 1
console.log(f("13"     )) // -> 2
console.log(f("101"    )) // -> 0
console.log(f("128"    )) // -> 4
console.log(f("313"    )) // -> 10
console.log(f("1003"   )) // -> 2
console.log(f("7129"   )) // -> 42
console.log(f("81128"  )) // -> 47
console.log(f("999999" )) // -> 0
console.log(f("9999999")) // -> 9000

Commented
f = ([c, ...s],           // c = current character, s = array of remaining characters
                l = 0) => // l = left part of the integer, initialized to 0 (see footnote)
  c ?                     // if c is defined:
    Math.min(             //   return the minimum of:
      Math.abs(           //     1) the absolute value of:
        (l += c) -        //       the updated left part
        s.join``          //       minus the right part
      ),                  //     end of Math.abs()
      f(s, l)             //     2) the result of a recursive call
    )                     //   end of Math.min()
  :                       // else:
    l                     //   stop the recursion by returning l (now equal to the input)

Non-recursive (ES7), 65 bytes
Takes input as a string.
s=>Math.min(...[...s].map(c=>((l+=c)-s.slice(++i))**2,i=l=0))**.5

Test cases

let f =

s=>Math.min(...[...s].map(c=>((l+=c)-s.slice(++i))**2,i=l=0))**.5

console.log(f("10"     )) // -> 1
console.log(f("11"     )) // -> 0
console.log(f("12"     )) // -> 1
console.log(f("13"     )) // -> 2
console.log(f("101"    )) // -> 0
console.log(f("128"    )) // -> 4
console.log(f("313"    )) // -> 10
console.log(f("1003"   )) // -> 2
console.log(f("7129"   )) // -> 42
console.log(f("81128"  )) // -> 47
console.log(f("999999" )) // -> 0
console.log(f("9999999")) // -> 9000

Commented
s =>                            // given s
  Math.min(...                  // get the minimum value in the result of this map():
    [...s].map(c =>             //   for each character c in s:
      ((l += c)                 //     append c to l (the left part)
                - s.slice(++i)) //     and subtract the right part from it
      ** 2,                     //     square the result
      i =                       //     start with i = 0 (split position)
      l = 0                     //     and l = 0 (left part, see footnote)
    )                           //   end of map()
  )                             // end of Math.min()
  ** .5                         // return the square root of the smallest square

Note: In both versions, l is coerced to a string on the first iteration. Normally, we should be careful about leading zeros in a numeric literal: 0123 - 10 === 73 because 0123 is parsed as an octal value (this is now deprecated, but still valid in non-strict mode). But '0123' - '10' === 113, the leading zero being this time ignored. So, it's sound to do so.
From the specification of the abstract operation ToNumber applied to a string:

A StringNumericLiteral that is decimal may have any number of leading
  0 digits

Jelly, 10 bytes
ŒṖṖLÐṂḌIAṂ

Try it online!
-3 bytes thanks to dylnan
How it works
ŒṖṖLÐṂḌạ/€Ṃ - Main link. Argument: n (integer)    e.g    7129
ŒṖ          - Partitions of n's digits;                  [[7, 1, 2, 9], [7, 1, [2, 9]], [7, [1, 2], 9], [7, [1, 2, 9]], [[7, 1], 2, 9], [[7, 1], [2, 9]], [[7, 1, 2], 9], [7, 1, 2, 9]]
  Ṗ         - Remove the final element                   [[7, 1, 2, 9], [7, 1, [2, 9]], [7, [1, 2], 9], [7, [1, 2, 9]], [[7, 1], 2, 9], [[7, 1], [2, 9]], [[7, 1, 2], 9]]
    ÐṂ      - Keep the lists with the minimum...         [[7, [1, 2, 9]], [[7, 1], [2, 9]], [[7, 1, 2], 9]]
   L        -   length
      Ḍ     - From digits                                [[7, 129], [71, 29], [712, 9]]
        /   - Reduce...
         €  - ...each...
       ạ    - ...by absolute difference                  [122, 42, 703]
          Ṃ - Take the minimum                           42

You can change L=2$$Ðf to ṖLÐṂ in this case

Funky, 159 134 99 bytes
s=>{S={}fori=1i<#s i++{S[#S]=(((v=s::sublist)(0,i)::reduce@..-v(i)::reduce@..)^2)^.5};math.min...S}

Actually fitting the spec is shorter it seems.
Try it online!

Retina, 36 bytes
\B
,$'¶$`
\d+
$*
(1*),\1

Om`^.*
\G1

Try it online!
Explanation
\B
,$'¶$`

This generates all possible partitions on separate lines, as well as a trailing line with the original input.
\d+
$*

Convert each number in each partition to unary.
(1*),\1

Remove a maximal and equal amount of 1s from both parts of each partition (i.e. remove the minimum, and subtract it from the maximum, which gives the absolute difference).
Om`^.*

Sort the lines.
\G1

Count the 1s on the first line, which gives the minimal absolute difference.

J, 32, 27 23 bytes
-5 bytes thanks to FrownyFrog! -4 bytes if input is a string.
[:<./}:@(".\)|@-1}.".\.

Try it online!
Original:
Takes a number as input
(".\(}:@[([:<./|@-)}.@])".\.)@":

How it works:
                             @": - convert the number to list of chars and
(".\                    ".\.)    - form all prefixes/suffixes and convert them to numbers
    (}:@[          }.@])         - drop the last prefix / first suffix
         (     |@-)              - find the absolute differences
          [:<./                  - find the minimum

Try it online!

Python 2, 58 bytes
lambda n:min(abs(n%10**i-n/10**i)for i in range(len(`n`)))

Try it online!

Pyth, 15 bytes
hSmaFvMdfqlT2./

Try it online!

MATL, 15 bytes
"GX@:&)UwU-|vX<

Input is a string representing the integer.
Try it online! Or verify all test cases.
Explanation
"         % Implicit input. Do the following as many times as input length
  G       %   Push input
  X@      %   Push iteration index (1-based), k
  :       %   Range: gives [1 2 ... k]
  &)      %   Two-ouput reference indexing: gives a substring with the first
          %   k characters in the input and then a substring with the rest
  U       %   Convert to number
  wU      %   Swap, convert to number
  -|      %   Absolute difference
  v       %   Vertically concatenate stack. This concatenates the obtained
          %   absolute difference with the minimum so far; does nothing in
          %   the first iteration
  X<      %   Minimum of array
          % Implicit end. Implicit display

Clean, 106 83 bytes
import StdEnv
@n#f=toInt o(%)n
=hd(sort[abs(f(0,i)-f(i+1,size n))\\i<-[0..size n]])

Defines the function @, taking a string.
Mostly self-evident, the only tricky bit is f=toInt o(%)n: This takes the toInt class of functions, and composes it (o) with the curried slice operator class (%) already supplied with the first argument (n). Since there is only one type (String, equivalent to {#Char}) which has overloads for both % and toInt the line actually compiles, whereas normally it's hard to compose functions when golfing due to the lack of contextual information given to the compiler.
Try it online!

Wolfram Language (Mathematica), 66 bytes
Min@Abs[#-#2&@@FromDigits/@#&/@ReplaceList[#,{a__,b__}:>{a}|{b}]]&

Takes a list of digits.
Try it online!

Jelly, 12 bytes
JṬ€œṗ€⁸Ḍạ/€Ṃ

A monadic link taking a list of digits and returning the integer.
Try it online!
How?
JṬ€œṗ€⁸Ḍạ/€Ṃ - Link: list of digits     e.g. [7,1,2,9]
J            - range of length               [1,2,3,4]
 Ṭ€          - untruth €ach                  [[1],[0,1],[0,0,1],[0,0,0,1]]
      ⁸      - chain's left argument         [7,1,2,9]
   œṗ€       - partition at truthy for €ach  [[[],[7,1,2,9]],[7,[1,2,9]],[[7,1],[2,9]],[[7,1,2],9]]
       Ḍ     - undecimal (vectorises)        [[0,7129],[7,129],[71,29],[712,9]]
         /€  - reduce €ach by:
        ạ    - absolute difference           [7129,122,42,703]
           Ṃ - minimum                       42

Pyth, 10 bytes
hSaMv<./Ql

Test suite
Takes input as a string.
This uses one of Pyth's more recent features, which is that applying a function to a list defaults to mapping the function over the list, if no other behavior is defined. This means that v applied to a list of list of strings evaluates all of the strings.
hSaMv<./Ql
hSaMv<./QlQ    Implicit variable
      ./Q      Form all partitions of the input string.
               Split it in all possible ways, maintaining the order.
               Partitions are ordered from shortest to longest.
     <   lQ    Take the prefix as long as the input string.
               This keeps just the splits into one and two pieces.
    v          Evaluate. All strings are converted to numbers.
  aM           Map the absolute difference function.
hS             Minimum

Note that the list of splits allows the split into 1 piece, but the value of this will always be larger than the minimum, so it is safely ignored.

Tcl, 116 bytes
foreach d [split [set b [set R $argv]] {}] {append L $d
regexp .(.+) $R - R
set b [expr min($b,abs($L-$R))]}
puts $b

Try it online!
Explanation
b ← R ← input number
for each digit (d) in the input number:
  L += d
  strip first digit off of R using a regular expression
  b ← min( b, distance between L and R )
print b

It works by using a regex trick allowing a degenerate final case that will always compute to greater than the minimum difference. For “12345” the values are:
1 2345 → 2344
12 345 → 333
123 45 → 78
1234 5 → 1229
12345 5 → 12340 (degenerate case)

You can shave bytes using lmap instead of foreach: https://tio.run/##LYuxCsMgFEV3v@IOb1DaZO8/ZHItDlolBEx4qC2FkG9/NaQHLgcunPbKInn1jIhn5by0rtQQLlmQL/PHOexHn2dOW8QEiqqkOX0Zox5vBmQxwKp/2f@Cddk0hbsPVdM0kDXGHYrfrYKCiDxOfg

Perl 5, 51 41 + 1 (-p) = 42 bytes
$\=$_;$\=$\>($"=abs$'-$`)?$":$\while//g}{

Try it online!
inspired by @Nahuel-Fouilleul's comment

46 bytes $\--;$d=abs$``-$',$\=$\<0|$d<$\?$d:$\while//g}{

Java 8, 88 82 79 bytes
n->{int r=-1,t,p=1;for(;n>=p;p*=10)r=r<0|(t=Math.abs(n/p-n%p))<r?t:r;return r;}

Port of @Dennis' Python 2 answer.
-66 bytes thanks to @NahuelFouilleul.
-3 bytes thanks to @ceilingcat.
Try it online.

n->{int r=-1,d,p=1;for(;n>=p;p*=10){d=Math.abs(n/p-n%p);if(r<0|d<r)r=d;}return r;} 82 bytes

@NahuelFouilleul Thanks! Should have known it would be possible to combine both methods..

Ruby, 44 bytes
->a{((w=1)..a).map{((a%w*=10)-a/w).abs}.min}

Try it online!

APL+WIN, 31 bytes
⌊/|(⍎¨m↓¨⊂n)-⍎¨(m←⍳¯1+⍴n)↑¨⊂n←⎕

Prompts for screen input of integer as a string.
Explanation:
m←⍳¯1+⍴n Create a list of numbers from 1 to length of string - 1

↑¨⊂n←⎕ Using m create a nested vector taking successively characters from the front of the string defined by m

⍎¨ Convert from character to integer

(⍎¨m↓¨⊂n) Using m create a nested vector dropping successively characters from the front of the string defined by m

⌊/| take the minimum absolute value after subtracting the two vectors of integers

I don't know APL, is there a way to test this?

Unfortunately APL+WIN is not in TIO. If you want to play with APL you can download a copy of APLX from the Dyalog website for free and my code works with it. It does not work in Dyalog's Try APL on-line. https://www.dyalog.com/aplx.htm

C# (.NET Core), 112 107 + 18 = 125 bytes
n=>Enumerable.Range(1,n.Length-1).Min(i=>System.Math.Abs(int.Parse(n.Remove(i))-int.Parse(n.Substring(i))))

Try it online!
The count includes the 18 bytes in using System.Linq;. Takes input as a string.

5 bytes saved by Caius Jard!

string.Remove might save you a few bytes

PHP, 121 bytes
-2 bytes for removing the closing tag
 <?php $x=fgets(STDIN);for($i=1;$i<strlen($x);$i++){$z[$i-1]=abs(substr($x,0,strlen($x)-$i)-substr($x,-$i));}echo min($z);

Try it online!
I'm a bit late on this challenge because last night another family member was on the desktop computer and it's a little difficult to post an answer on mobile!

You can't be late on a challenge!

Perhaps, but I would have liked to have done it sooner! I just started golfing and am eager to answer what I can.

Understandable, but I appreciate every answer, even if it's for old challenges and by old I mean like at least 1 year :) Btw. welcome to PPCG, have fun!

Common Lisp, 131 bytes
My first time participating in code golf and I decided to use Lisp, since I like it.
Here is my solution:
(defun f (s) (loop for i from 1 below (length s) minimizing (abs (- (parse-integer (subseq s 0 i)) (parse-integer (subseq s i))))))

Input needs to be a string, not integer or list.

Welcome to PPCG! Unfortunately I don't know Lisp, but I noticed that you can shorten this by 11 bytes if you make it an unnamed function and remove some whitespace, see here. If you haven't seen this, maybe you'll find some tips.

Python 3, 104 bytes
My second ever PPCG answer.
o=input();d=[]
for i in range(len(o)-1):
 f=int(o[:i+1]);s=int(o[i+1:]);d.append(abs(f-s))
print(min(d))

Try it online!

You can inline f and s since you only need them once, also you wouldn't need to construct the list as you're only taking the min, but this would essentially  become this answer.

@BruceForte Ah. I'm not very good at doing that kind of thing in Python.

Stax, 13 bytes
ä╠╗╡♫ñ=╣n╤-±å

Run and debug it
Rare occurrence where the box drawing characters connect with each other.

Thunno 2 M, 7 bytes
żṫıÇɱỵṛ

Try it online!
Explanation
żṫıÇɱỵṛ  # Implicit input
żṫ       # Push [1..length)
  ı      # Map over this list:
   Ç     #  Apply parallelly:
    ɱ    #   First n characters from input
     ỵ   #   Remove first n characters from input
      ṛ  #  Absolute difference
         # Implicit output of minimum

Desmos, 66 51 bytes
-15 bytes thanks to Aiden Chow!
a=10^{[1...logn]}
f(n)=abs(floor(n/a)-mod(n,a)).min

Try it on Desmos!

51 bytes


text:
Print a flag in as little lines as possible!
Just for fun, I wanted to see how little lines I could solve this problem in, using python. I managed to condense my code into 9 lines.
size = int(input("Size: "))
a = [x for x in range(size-2, -1, -1)] if size % 2 == 0 else [x for x
in range(size-2, 0, -1)]
b, counter = a[::-1], 0
print("\n"+"\\"+"#"*size+"/") #top
for i in a[::2]: print("#"+" "*counter+"\\"+" "*i +"/"+ " "*counter+
"#"); counter += 1
if size % 2 != 0: print("#"+" "*counter+"X"+ " "*counter+ "#")
counter = int((size-2)/2)
for i in b[::2]: print("#"+" "*counter+"/"+" "*i +"\\"+ " "*counter+
"#"); counter -= 1
print("/"+"#"*size+"\\"+"\n") #bottom
as you can probably tell by the output the code is meant to produce
flags based on an integer from the user

with even number flags looking like this
\####/
#\  /#
# \/ #
# /\ #
#/  \#
/####\

and odd number flags looking like this, with the cross in the middle
\#####/
#\   /#
# \ / #
#  X  #
# / \ #
#/   \#
/#####\

I just wanted to see if anyone else could beat me, one of my classmates did it in four lines. Good luck :)
code with the least number of lines and bytes wins!

Hi, Since this is programming challenges, you need a winning criteria explicitly stated. The easiest would be code-golf and at the end of the problem add the the statement The shortest code in bytes for each language wins. Because in it's current state the community will most likely vote to close your problem.

Also limiting solutions to only one language is also a bad idea, maybe remove the python only requirement, someone is sure to answer in python anyway

Note that "fewest number of lines" is not a good winning criterion, as most languages can easily put their whole code in one line. Even in python you can simply write exec"code" to get everything in one line.

Sandbox can be a great place to bounce ideas off of: https://codegolf.meta.stackexchange.com/questions/2140/sandbox-for-proposed-challenges/

This isn't an exact duplicate. This one only has # at the edge with spaces in the open areas while the other one is filled with #. It's not different enough for me cast a reopen vote though, especially while it's still restricted to python. Also it should say "least bytes." "lines and bytes" is two conflicting criteria.

@LevelRiverSt Could it be turned into a tips question?

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
A very long Terza Rima
Description
Output the rhyme scheme for a very long Terza Rima.
Input
None.
Output
ABA
BCB
CDC
DED
EFE
FGF
GHG
HIH
IJI
JKJ
KLK
LML
MNM
NON
OPO
PQP
QRQ
RSR
STS
TUT
UVU
VWV
WXW
XYX
YZY

Rules
You can pick between separating stanzas with whitespace or newlines, so either:
ABA BCB...

OR
ABA
BCB
...

A single trailing whitespace allowed per line and one trailing newline allowed.
Output can be either uppercase or lowercase.
This is code-golf, so the shortest code in bytes for each language wins.

Is a list of lines okay?

According to https://en.wikipedia.org/wiki/Terza_rima your ending is wrong. It should end with either Z or ZZ.

Can there be additional output beyond the rhyme scheme? This might save me a few bytes.

@NK1406 Nope sorry.

@totallyhuman String array is fine.

@Chris I found it here. Which says it can be YZY,

@LiefdeWen: Huh. Weird. Sadly I don't know which is correct or I'd edit wikipedia to be consistent. :)

Related

@LiefdeWen From your Wiki I see “YZY/Z” or “YZY/ZZ” or “YZY/ZYZ.” No “YZY and that’s it.”

JavaScript (ES6), 51 50 49 bytes
Saved 1 byte thanks to @l4m2
f=(n=45358)=>n%63?f(n-1333)+n.toString(36)+' ':''

Try it online!
How?
We start with n = 45358 (yzy in base-36). We subtract 1333 from n at each iteration (111 in base-36). We stop as soon as n MOD 63 = 0, because 12033 (9a9 in base-36) is the first value for which this condition is fulfilled, and 63 is the smallest modulo with such a property.
Decimal | Base-36 | MOD 63
--------+---------+-------
  45358 |   yzy   |   61
  44025 |   xyx   |   51
  42692 |   wxw   |   41
  41359 |   vwv   |   31
  40026 |   uvu   |   21
  38693 |   tut   |   11
  37360 |   sts   |    1
  36027 |   rsr   |   54
  34694 |   qrq   |   44
  33361 |   pqp   |   34
  32028 |   opo   |   24
  30695 |   non   |   14
  29362 |   mnm   |    4
  28029 |   lml   |   57
  26696 |   klk   |   47
  25363 |   jkj   |   37
  24030 |   iji   |   27
  22697 |   hih   |   17
  21364 |   ghg   |    7
  20031 |   fgf   |   60
  18698 |   efe   |   50
  17365 |   ded   |   40
  16032 |   cdc   |   30
  14699 |   bcb   |   20
  13366 |   aba   |   10
  12033 |   9a9   |    0

How did you decide base36? and are you sure its optimal?

@LiefdeWen It's the lowest base to contain all the letters, so it's optimal.

@user202729 What do you mean? He's not OP, so he's one of those people you refer to?

@EriktheOutgolfer Ok, that's fair. I can't force everyone to put answers into spoiler tag like in puzzling SE.

As an (un)interesting side-node, 1333 = 666*2+1 and this is my 666th answer on PPCG.

@Arnauld please ensure you use the value 1335 somewhere in your next answer.

f=(n=45358)=>n%63?f(n-1333)+n.toString(36)+' ':'' 1B shorter

mod 63 and and 62 both work. Order matter

C (gcc), 41 bytes
f(i){for(i='ABA';i%29;i+=65793)puts(&i);}

Try it online!
Fixed and -9 thanks to user202729. -1 thanks to Dennis and -2 thanks to Arnauld too.

45 bytes.

(i='ABA';i<'ZZZ';i+=65793) saves a byte.

Use 59e5 instead of 'ZZZ' saves another byte.

You can use i%29 for 41 bytes

Jelly, 7 bytes
ØAṡ2ŒBY

Try it online!
-1 byte thanks to Dennis
ØAṡ2ŒBY  Main Link
ØA       Alphabet
  ṡ2     Slice into overlapping slices of length 2
    ŒB   Palindromize (bounce) each
      Y  Join by newlines

05AB1E, 5 bytes
Aü«€û

Try it online!
-1 byte thanks to Emigna
-1 byte thanks to rule change; thanks to kalsowerus for pointing that out
Hehe, currently beats Pyth. \o/
Explanation
Aü«€û   Full Program
A       Lowercase Alphabet
 ü«     Pairwise with merge-list
   €û   For each, palindromize

You could do Aü«€û»

@Emigna O cool, thanks! :D

Nice, that's what I got too without looking.

According to the comments, a list of strings is fine as output, you can remove the join.

brainfuck, 51 48 bytes
Saved 3 bytes thanks to @ovs.
++++++++[>+>+++>++++++++<<<-]>++>+[->+.+.-.<<.>]

Try it online!
Explanation
INITIALIZE TAPE:

0000:           (none)
0001: C_NEWLINE (10)
0002: V_COUNT   (25)
0003: V_ALPHA   (64)
++++++++[>+>+++>++++++++<<<-]>++>+

V_COUNT TIMES:              [-
    INCREMENT V_ALPHA         >+
    PRINT V_ALPHA             .
    PRINT V_ALPHA PLUS ONE    +.
    PRINT V_ALPHA             -.
    PRINT C_NEWLINE           <<.
END LOOP                    >]

@ConorO'Brien - I just noticed that my answer is pretty similar to yours. Please feel free to comment if you think it is too close and I'll remove it.

@ElPedro No, you're fine, there isn't much room for innovation in this challenge :)

brainfuck, 51 49 bytes
+++++[>+++++>+++++++++++++>++<<<-]>[>.+.-.+>.<<-]

Try it online!
An attempt at an explanation...
+++++                     #Put 5 in cell 0 because that is the highest common denominator of 10, 65 and 25
[                         #Start loop
>+++++                    #Counter in cell 1 is 25 (How many lines we must print)
>+++++++++++++            #Counter in cell 2 is 65 (ASCII A)
>++                       #Counter in cell 3 is 10 (Newline)
<<<-]                     #Decrement the outer counter until the cells have the right values (muliples of 5).
>                         #Move to the counter that says how many lines we must print.
[>.                       #Print the character in cell 2
+.                        #Add one to the character in cell 2 and print it
-.                        #Subtract one from the character in cell 2 and print it
+                         #Add one to the character in cell 2 for the next loop
>.                        #Print a new line
<<-]                      #Decrement cell 1 and run again until cell 1 is 0

-2 with thanks to @ovs
My first attempt at brainfuck so any hints gratefully received. If I was more experienced with it then I am sure I could shave a few more bytes off but I only got into it yesterday.

-1 byte

Python 2, 42 41 bytes
-1 byte thanks to Halvard Hummel

i=65;exec"print'%c'*3%(i,i+1,i);i+=1;"*25

Try it online!

APL (Dyalog), 14 bytes
25↑0 1 0⊖3/⍪⎕A

Try it online!
Please note that the added ⎕← is for TIO to output the text and is not normally required.

Charcoal, 11 bytes
Ｅ²⁵✂αι⁺²ι‖Ｏ

Try it online! Link is to verbose version of code. Explanation:
 ²⁵         Literal 25
Ｅ           Map over implicit range
    α       Predefined uppercase letters
   ✂ ι⁺²ι   Slice 2 characters
            Implicitly print result on separate lines
         ‖Ｏ Reflect with overlap

Brain-Flak, 90 bytes
((((()()()){}){}){}()){(({})<((({}((((()()()()){}){}){}){})())[()])((()()()()()){})>[()])}

Try it online!
One reason this is shorter than the other brain-flak answer is because it uses uppercase instead of lowercase characters, which have smaller ASCII values, and are therefore easier to push.
Explanation:
#Push 25
((((()()()){}){}){}())

#While true
{

    #Keep track of the number on top of the stack...
    # We'll call it 'a'
    (({})

        #Push A +...
        <((({}

        # 64 (push)
        ((((()()()()){}){}){}){})
        # + 1 (push)
        ())
        # - 1 (push)
        [()])

        # Push 10
        ((()()()()()){})>

    # Now that's all pushed, we push a - 1 to decrement the loop counter
    [()])

# Endwhile
}

I write the first version and get no upvotes you write a golf version and get +5. ???

brainfuck, 45 37 bytes
+[[<+>>++<-]>]<<---[-----<+.+.-.<.>>]

Try it online!
Prints in uppercase, separated by spaces with a trailing space.
How it Works:
+[[<+>>++<-]>] Intialises the tape with the format n^2
               1 2 4 8 16 32 64 128 0 0'
<<---          Navigates to the desired section and tweaks the counter
               1 2 4 8 16 32 64 125<
[-----<+.+.-.<.>>] Prints the Terza Rima, using:
                 125 as the loop counter (decremented by 5 each loop)
                 64 as the current alphabetic character (incremented and printed each loop)
                 32 as the space character

This is actually really nice! Good job!

><>, 25 24 23 22 bytes
Saved 2 bytes thanks to Jo King
"!;::o1+:o$oao:'Y')0.A

Try it online!

23 bytes by removing a quote

Another byte

@JoKing: Thanks again!

R, 51 47 bytes
L=LETTERS;cat(sprintf("%s%s%1$s",L[-26],L[-1]))

Output:
> L=LETTERS;cat(sprintf("%s%s%1$s",L[-26],L[-1]))
ABA BCB CDC DED EFE FGF GHG HIH IJI JKJ KLK LML MNM NON OPO PQP QRQ RSR STS TUT UVU VWV WXW XYX YZY

The naive way without fancy sprintf is 49 bytes

@Giuseppe that would be because i didn't use sprintf correctly :)

OK, but I found a 40 byter :)

@Giuseppe ouch :)

another [40 byter][https://tio.run/##K/r/PzmxRCMzryQkP7QkzUKjKCkzL0WjwkbXzNTKwlKnQttQp0LH0EBTU/P/fwA] based on converting ASCII codes, in case

@Giuseppe you probably should post it as a concurrent answer! NofP: you too!

@NofP not sure if you got notified, so I'm tagging you in this; and notifying plannapus that I've posted my solution as well.

Befunge-98 (FBBI), 27 23 21 bytes
-4 bytes thanks to James Holderness
j'@1+3k:,1+,,a,'Y/!1+

Try it online!

Java 8, 132 85 62 60 Bytes

47 bytes thanks to Neil
26 bytes thanks to Oliver
3 bytes and much better formatting thanks to Kevin
Error fixed by Oliver

Golfed
a->{for(char i=64;++i<90;)System.out.println(""+i+++i--+i);}

Ungolfed
public class TerzaRima {
    interface A{
        void a(String a);
    }
    static A a = a -> {
        for (char i = 64; ++i < 90; ) System.out.println("" + i++ + i-- + i);
    };
    public static void main(String[] args){
        a.a(null);
    }
}

Printing a char array would probably be a lot shorter.

Thanks @Neil, didn't even think about that

Can you make i a char too?

a->{for(char c=64;++c<90;)System.out.println(""+c++ +c--+c);} (62 bytes)

Currently this is a snippet instead of a function or program, so you'll have to add the v->{...} as mentioned above by @OlivierGrégoire. (In case you don't know how Java 8 lambdas work, I made an explanation once before.) Also, you can remove the brackets of the loop like Olivier did, and as additional golf you can change the print to System.out.print(" "+i+++i--+i); (a space instead of a new-line, and you don't need the space at c+++c--+c). Try it here.

@KevinCruijssen sorry, I made this without testing, hence the extraneous space I thought was mandatory. And indeed a lambda is required instead of a pure snippet. However no leading whitespace is allowed so I would reuse the println instead of print with a leading whitespace.

Thanks @KevinCruijssen for the tips as well as the java lambdas document. That was a very easy to follow guide to implement some simple lambdas. I have updated accordingly!

@DevelopingDeveloper only trailing spaces/lines are allowed, not leading spaces. The fix is to use println: v->{for(char i=64;++i<90;)System.out.println(""+i+++i--+i);}

@OlivierGrégoire Thanks for catching that and the quick fix!

Vyxal j, 3 bytes
nzʁ

Try it Online!
n   # Lowercase alphabet
 z  # Overlapping pairs of elements
  ʁ # Mirror each
    # (j flag joins list of lines by newlines)

Husk, 9 bytes
ẊS:`e…"AZ

Try it online!

brainfuck, 41 bytes
-[[<+>--->++>>>+<<<<]>+]>>>[<<.+.-.+>.>-]

Try it online!

+1 I follow most of it but it starts with -[ Does that mean you are setting cell 0 to -1 before you start the loop? Any chance of an explanation for a brainfuck newbie if you have time? Btw, thanks for the -2 on my effort.

@ElPedro this depends on the brainfuck interpreter, the interpreter at tio.run stores unsigned 8-bit numbers in each cell, so the first cell gets 255 before the loop.

@ElPedro the initialization segment is actually generated by BF-Crunch.

Pyth, 7 bytes
jC[GtGG

Try it here!
Hehe, currently beats Jelly. \o/
Easily translates to the follwong 05ab1e program:
05AB1E, 7 bytes
AA¦A)ø»

Try it online!

Haskell, 28 bytes
[[x,succ x,x]|x<-['A'..'Y']]

Try it online!
succ is such an unfortunate naming choice...
Explanation
[[x,succ x,x]|x<-['A'..'Y']]

[            |x<-          ]  -- for x in...
                 ['A'..'Y']   -- the alphabet sans Z
 [x,succ x,x]                 -- construct a string of x, the successor of x and x

I do not feel like it is completely fair to return a list of strings instead of separating them with space or newline as required.

@user28667 It's usually allowed in challenges (it probably should be on the Default IO post, if it's not already). The OP is yet to respond in this challenge specifically. This is, however, no reason to downvote.

@totallyhuman At the moment the challenge explicitly specifies that either spaces or newlines should be used to separate the output, thus this answer is currently invalid. So strictly according to the site rules it should be deleted, or just fixed by prepending a unlines or unwords.

@Laikoni I seem to have ninja'd you. The challenge doesn't explicitly deny a list of lines as output. (Plus, that would invalidate a fair amount of answers.) Either way, the answer is now not invalid.

J, 15 bytes
u:2$~&3\65+i.26

Try it online!

This is a tricky way to make a palindrome!

PowerShell, 39 37 bytes
65..89|%{-join[char[]]($_,++$_,--$_)}

Try it online!
Loops from 65 to 89. Each iteration, we're constructing an integer array of (the current, one more, and the current) of the current digit, using pre-increment and pre-decrement. That's then re-cast as a char-array, and -joined together into a single string. Each string is left on the pipeline and an implicit Write-Output at program completion gives us a newline between each element for free.

Alternatively, same byte count
65..89|%{-join[char[]]($_,($_+1),$_)}

Try it online!

($_,($_+1),$_) is an alternative same-length tuple

Haskell, 34 32 31 bytes
Based on totallyhuman's answer. -1 byte thanks to H.PWiz
do x<-['A'..'Y'];x:succ x:x:" "

Try it online!

save a byte with do

Brain-Flak, 180 bytes
(()()())(({}){})(({}){})(({}){})(({}){})(({}){}())<>(()()()()())(({}){})(({}){})(()()()()(){}){({}[()])<>(({}))(({}()))(({}[()]))({}()<(()()()()()()()()()())>)<>}<>{}{}{({}<>)<>}<>

Try it online!
Thanks to DJ for getting this working

R, 40 36 bytes
cat(paste0(L<-LETTERS,L[-1],L)[-26])

Try it online!
An alternative to plannapus' answer; this turns out to be a bit golfier; I've posted it per his request.
See also this 40 byte answer by NofP which is quite nice.

R, 40 bytes
cat(intToUtf8(rbind(x<-65:89,x+1,x,10)))

Try it online!
One more alternative in R to Plannapus and Giuseppe's answers. Posted following their request. This solution uses ASCII code to UTF8 coding.
PS if TABs were allowed, one could replace the newline (ASCII code 10) with a tabulation (ASCII code 9), and the solution could shrink to 39 bytes:
cat(intToUtf8(rbind(x<-65:89,x+1,x,9)))

I think using 9 is perfectly fine, since it's whitespace, which is allowed by the OP.

Pepe, 59 56 bytes
-3 bytes thanks to u_ndefined
REeEeEEeEerEeEeeeeeERrEEEEErEEEeeREEreeerEEEEEeeEreeERee

Try it online!
Explanation:
# Prepare stacks

  # prepare stack R [Z]
  REeEeEEeEe  # push Z

  # prepare stack r [A,B,A]
  rEeEeeeeeE  # push A
  RrEEEEE     # copy and increment A (getting B)
  rEEEee      # duplicate A to end

# Start loop
REE           # create label Z

  reee        # output stack r contents
  rEEEEEeeE   # increment all

  reeE        # end line

Ree           # loop while r[p] != Z

Replacing rEeEeeeeEe with RrEEEEE saves off 3 bytes

@u_ndefined Thanks! I made this code before flags were added to Pepe. Updated the answer.

Pip, 8 bytes
PZ_.BMPz

Try it online!

vJASS (Warcraft 3), 203 189 182 177 156 bytes
Using //! import zinc "<code_path>" command to exclude //! zinc and //! endzinc.

library q{integer w,e;string r="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t;function onInit(){for(0<=w<25){e=w+1;t=SubString(r,w,e);BJDebugMsg(t+SubString(r,e,e+1)+t);}}}

Readable Version:
library q{
    integer Index, Increment;
    string Alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Letter;

    function onInit(){
        /*
        *   Index from 0 to 24
        */
        for (0 <= Index < 25){
            Increment = Index + 1;

            // Slice
            Letter = SubString(Alphabets, Index, Increment);

            // Output
            BJDebugMsg(Letter + SubString(Alphabets, Increment, Increment + 1) + Letter);
        }
    }
}

Verification purposes only:
The in-game text screen has limited space. Using Preload(), we may able to see the full output.
//! zinc
library q{
    integer Index, Increment;
    string Alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Letter;

    function onInit(){
        // Create an empty text file (Preload file).
        PreloadGenClear();
        PreloadGenStart();

        /*
        *   Index from 0 to 24
        */
        for (0 <= Index < 25){
            Increment = Index + 1;

            // Slice
            Letter = SubString(Alphabets, Index, Increment);

            // Output
            Preload(Letter + SubString(Alphabets, Increment, Increment + 1) + Letter);
        }

        // Save .txt
        PreloadGenEnd("CodeGolf\\testOutput.txt");
    }
}
//! endzinc

J, 18 16 bytes
2(,{.)\u:65+i.26

Changed a.{~ to u: after Conor O'Brien's and FrownyFrog's solutions
Try it online!

Alternative 16 byte: u:(i.25)+/66-#:5

Ruby, 32 bytes
puts (?A..?Y).map{|c|c+c.next+c}

Try it online!

If a list of strings is valid output:
Ruby, 31 bytes
->{(?A..?Y).map{|c|c+c.next+c}}

Try it online!

Befunge, 26 bytes
:"A"+:,:1+,,1+:64*`#@_55+,

Try it online!

Vyxal 3 j, 4 bytes
moᵛṅ

Try it Online!
same as vyxal 2 but the byte lost from not having vectorized mirror is saved from the one byte capital alphabet builtin

Zsh, 40 bytes
eval '<<<$[[##36]'{13366..45358..1333}\]

Attempt This Online!

Retina, 24 bytes

ABA
;{:G`
T`_p`p`[^Y]..

Try it online!

21 bytes but suffers from trailing newlines...

@Neil Yeah, you don't even need the \...`. Getting rid of those trailing newlines is really annoying though. I'm hoping to make printing in loops a bit more flexible and convenient in Retina 1.0.

Perl 5, 27 24 bytes
say$\=$_++,$_.$\for A..Y

previous solution
say$_,chr 1+ord,$_ for A..Y

Try it online

K (oK), 17 16 bytes
Solution:
`c$010b+/:65+!25

Try it online!
Explanation:
Might be a better way, but this is what I came up with:
`c$010b+/:65+!25 / the solution
             !25 / til 25 => 0..24
          65+    / add 65 -> 65..89
       +/:       / add left to each right
   010b          / boolean array of 0 1 0
`c$              / cast to ASCII characters

MATL, 12 11 10 bytes
1 byte off thanks to Luis Mendo, by using 5B (5 in binary) to push a [1 0 1] pattern.
66:90!5B-c

Try it online!

brainfuck, 73 bytes
+++++++++++++[>+++++>+++++<<-]>>+<<<<+++++[>++>+++++<<-]>>[>.>.+<.+<-<.>]

Try it online!

T-SQL 189 154 bytes
declare @ char(26)='ABCDEFGHIJKLMNOPQRSTUVWXYZ',@i int=1,@@ char while(@i<26)begin  set @@=substring(@,@i,1)print @@+substring(@,@i+1,1)+@@ set @i=@i+1 end

Recursiva, 13 bytes
{B25"PpZ~}(;}

Try it online!

J (repl), 18 bytes
u:65+(,>:,])"+i.25

Try it online!
Can be made into a function for +4 bytes:
(u:65+(,>:,])"+i.25)"_

Other solutions:
u:|:65 66 65+/i.25

Explanation
u:65+(,>:,])"+i.25
              i.25     range [0, 25)
     (     )"+         on each number:
      ,  ,               create a list composed of the number,
       >:                the number + 1
          ]              and the number
                       this gives the 2D list [0 1 0] [1 2 1] ...
  65+                  add 65 to each element
u:                     convert to characters

Batch, 99 bytes
@set s=ABCDEFGHIJKLMNOPQRSTUVWXYZ
:l
@echo %s:~0,2%%s:~0,1%
@set s=%s:~1%
@if not %s%==Z goto l

Only 10 bytes shorter than a literal...

Kotlin, 42 bytes
{('A'..'Y').map{println("$it${it+1}$it")}}

Try it online!
or
{('A'..'Y').map{println(""+it+(it+1)+it)}}

Try it online!

Add++, 46 44 bytes
L,"ABCDEFGHIJKLMNOPQRSTUVWXYZ"dBREpBR2DBcEJn

Try it online!
Who needs all these "palindromise" functions?
2 bytes saved thanks to DLosc!
How it works (old version)
L,     - Create a nilary lambda function.
  "…"  - Push the uppercase alphabet;     STACK = ['ABC…XYZ']
  d    - Duplicate;                       STACK = ['ABC…XYZ' 'ABC…XYZ']
  BR   - Reverse;                         STACK = ['ABC…XYZ' 'ZYX…CBA']
  2D   - Duplicate from below;            STACK = ['ABC…XYZ' 'ZYX…CBA' 'ABC…XYZ']
  Ep   - Dequeue each;                    STACK = ['BCD…XYZ' 'YXW…CBA' 'BCD…XYZ']
  $BR$ - Reverse the middle string;       STACK = ['BCD…XYZ' 'ABC…WXY' 'BCD…XYZ']
  Bc   - Zip;                             STACK = [['A' 'B' 'A'] … ['Y' 'Z' 'Y']]
  EJ   - Join each;                       STACK = ['ABA' … 'YZY']
  n    - Join with newlines               STACK = ['ABA…YZY']

Shnap, 35 bytes
for c:'A'..'Z'println(""+c+(c+1)+c)

Try it online!

Brain-Flak classic, 160 150 118+2=120 bytes with -A flag
((((((()()()){}){}){}){}){}())<>(((((()()()()())){}){}){}){({}[])<>([{}])[({}())][({}[])]({}())[((()()()()()){})]{}<>}

Try it online!
The separator is a newline.
-8 bytes thanks to DJ
-32 bytes thanks to DJ

The first 50 bytes are rather redundant. in general, rather than doing (...)(({}){}) you can do ((...){}) to save 4 bytes. And of course, this can be nested several times. To push 'a' I would do ((((((()()()){}){}){}){}){}()) instead.

You can also use https://brain-flak.github.io/integer/ to autogolf large integers for you.

And minus 32 bytes

SNOBOL4 (CSNOBOL4), 83 82 81 79 72 bytes
R	&UCASE POS(I) LEN(1) . L @I LEN(1) . R	:F(END)
	OUTPUT =L R L	:(R)
END

Try it online!
I think I'm finally getting the hang of @!
SNOBOL variables are initialized automatically to "" which is also equivalent to 0. So the first time the interpreter sees line R, the line is:
&UCASE POS(0) LEN(1) . L @I LEN(1) . R  :F(END)

which finds a LENgth 1 string starting at POSition 0 (the beginning of the string), assigning the matched string to L. Then we assign the position of that match to I using @, which has been incremented by 1 because of the LEN(1) . L. The next character is then matched and assign it to R, and output L R L. This continues until I is 25, since then LEN(1) . R fails to match, as L would be Z.

Japt, 11 6 bytes
Returns an array of lines.
;BäÈiZ

Try it

Explanation

;B is the uppercase alphabet.
äÈ gets each pair of consecutive characters in a string and passes them through a function.
iZ prepends the current element to the first character of the current element.

Alternative, 6 bytes
;Bã mê

Try it

Explanation

ã splits the alphabet string into an array of consecutive character pairs.
m maps over the array.
ê palindromises the current element.

Array of lines is allowed.

Pushy, 9 bytes
Z1Z25:QKh

Try it online!
Explanation:
Z1Z          \ Make the stack [0, 1, 0]
   25:       \ 25 times do:
      Q      \    Print the stack, as indexes into the uppercase alphabet
       Kh    \    Increment all values

V, 16 bytes
¬azòóˆˆ/±²±\r²òd

Try it online!
Hexdump:
00000000: ac61 7af2 f388 882f b1b2 b15c 72b2 f264  .az..../...\r..d

Recursive Regular Expressions for the win!

Clean, 60 bytes
import StdEnv
t=foldr(+++)""[{c,c+one,c,' '}\\c<-['a'..'y']]

Try it online!
If a list of Char ([Char]) is okay instead of a String ({#Char}) (they look the same when printed bare), then we can save a few bytes and use:
Clean, 53 bytes
import StdEnv
t=flatlines[[c,c+one,c]\\c<-['a'..'y']]

Try it online!
If a list of String ([{#Char}]) representing the lines is acceptable, then we can save even more and use:
Clean, 45 bytes
import StdEnv
t=[{#c,c+one,c}\\c<-['a'..'y']]

Try it online!

Funky, 38 bytes
fori=65i<90i++print("%c%c%c"%{i i+1i})

Naïve solution, not very exciting, but it works.
Try it online!

dc, 24 bytes
65[ddP1+dPrPdAP90>M]dsMx

Try it online!
Pretty straightforward. Start with ASCII value for A, duplicate it a couple of times, print it, increment it and duplicate this, print it, swap the top-of-stack, print (the unincremented number), print a line feed, keep going as long as we haven't made it to Z (90).

Python 3, 55 bytes
' '.join(map(lambda x:"%c"*3%(x-1,x,x-1),range(66,91)))

Try it online!

-2 : ' '.join(map(lambda x:"%c"*3%(x,x+1,x),range(65,90)))

PHP, 72 bytes
-2 bytes because yay assumed values!
-15 bytes thanks to Francisco Hahn
<?php $x=ABA;for($i=0;$i<75;$i++){if($i%3==0){echo$x." ";}$t=$x[$i%3];$x[$i%3]=++$t;}?>

Try it online!
Takes the string "ABA" through a for loop which loops through each character and increments it. Displays the current value of the string every 3 times.

$x=ABA;for(;$i<75;$i++){echo($i%3)?"":$x." ";$t=$x[$i%3];$x[$i%3]=++$t;} 72

Cubically, 34 bytes
FRF'-2(+345@+33-5@-33+5@-33200@1)6

Try it online!
It was hard... At least it's doable. (without too much hardcoding)
Other Rubik's algorithm may lead to shorter sequence.
Some alternatives I tried (which is, unfortunately, longer):
35 bytes: Try it online!
36 bytes: Try it online!

Explanation:

FRF'      Rubik's cube algorithm. This algorithm has the property of make face
          value 1 equal to 10. (character of code of `\n`)
-2        Subtract face value 2 (which is 25) from the notepad.
(    )6   While notepad is nonzero:
+345        Add 90 to notepad.
@           Print notepad value.
+33-5       Add 1 to notepad.
@           Print notepad value.
-33+5       Subtract 1 from notepad.
@           Print notepad value.
-33200      Subtract 89 from notepad.
@1          Print face value 1 (which is 10, '\n')

Premier, 18 bytes
:| s |ns:'Z~*AUc
A

Try it online!
Explanation
The second line just defines the data for the program. So, starting wtih A on the stack...
:| s |ns:'Z~*AUc
:|   |n            print the following format:
  .                   TOS
   s                  TOS + 1
    .                 TOS
                   this prints out ABA, for example
       s:'Z~*      If the next char is not 'Z'
             A        append it to the data
              Uc   print a newline

This repeats until the next character is Z, at which point there is no data left, and the program terminates.

vim, 48 28 keystrokes

:h<_EnterjjYZZPqqy2llpi ESCl@qq@qD

My first attempt at golfing in vim
Explanation

:h<_EnterjjYZZP                    Insert the alphabet by copying it from the help manual
qq                                  Define a macro `q`:
 y2l                                 Copy the first two characters (relative to the cursor)
 lp                                  Paste after the copied characters (ABCDE -> ABABCDE)
 i Esc                             Insert a space (ABABCDE -> ABA BCDE)
 l@q                                 Run the macro again with the cursor after the space
q@q                                 End the macro defenition and run it
D                                   Remove the last Z

Go, 56 Bytes
func n(){for i:=65;i<90;i++{Printf("%c%c%c\n",i,i+1,i)}}

Ungolfed and readable:
func n() {
    for i := 65; i < 90; i++ {
        Printf("%c%c%c\n", i, i + 1, i)
    }
}

Try it online!

Go, 60 56 bytes
func t(){for i:=65;i<90;i++{Printf("%c%c%c\n",i,i+1,i)}}

Try it online!

K4, 15 bytes
Solution:
+-1 1 -1_\:.Q.A

Explanation:
Take A..Z, drop the last/first/last elements and then transpose:
+-1 1 -1_\:.Q.A / the solution
           .Q.A / "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        _\:     / drop (_) each-left from the right argument
 -1 1 -1        / the list (-1;1;-1)
+               / flip

GolfScript, 17 bytes
90,65>''+{.).(n}%

Try it online!
Explanation
90,65>            # Yield the uppercase alphabet
      ''+         # Convert to a string
         {     }% # For every codepoint in the string:
          .)      # Push the codepoint incremented
            .(    # Push the codepoint decremented
              n   # Push a newline

naz, 60 bytes
8a8m2x1v2d3m7s2x2v1x1f1v1a1o1a1o1s1o2x1v0m9a1a1o1v3x2v1l0x1f

Explanation (with 0x commands removed)
8a8m2x1v                               # Set variable 1 equal to 64 ("@")
2d3m7s2x2v                             # Set variable 2 equal to 89 ("Y")
1x1f                                   # Function 1
    1v                                 # Load variable 1 into the register
      1a1o1a1o1s1o                     # Output the next line of the rhyme scheme
                  2x1v                 # Store the value of the register in variable 1
                      0m9a1a1o         # Output a newline
                              1v       # Load variable 1 into the register
                                3x2v1l # Jump back to the start of the function
                                       # if the value in the register is less than variable 2
1f                                     # Call function 1

Python 3, 49 47 bytes
An obvious golf saved 2 bytes:
' '.join('%c'*3%(x,x+1,x)for x in range(65,90))

Try it online

Forth (gforth), 55 53 46 bytes
: f 90 65 do i i 1+ i emit emit emit cr loop ;

Try it online!
-6 bytes from bubbler.
a simple loop.

Looping through A to Y directly seems to be shorter.

Deadfish~, 674 bytes
{iiiiii}iiiiicicdc{ddddd}dddddc{iiiii}iiiiiicicdc{ddddd}ddddddc{iiiiii}dddcicdc{dddddd}iiic{iiiiii}ddcicdc{dddddd}iic{iiiiii}dcicdc{dddddd}ic{iiiiii}cicdc{dddddd}c{iiiiii}icicdc{dddddd}dc{iiiiii}iicicdc{dddddd}ddc{iiiiii}iiicicdc{dddddd}dddc{iiiiii}iiiicicdc{dddddd}ddddc{iiiiii}iiiiicicdc{dddddd}dddddc{iiiiii}iiiiiicicdc{dddddd}ddddddc{{i}ddd}dddcicdc{{d}iii}iiic{{i}ddd}ddcicdc{{d}iii}iic{{i}ddd}dcicdc{{d}iii}ic{{i}ddd}cicdc{{d}iii}c{{i}ddd}icicdc{{d}iii}dc{{i}ddd}iicicdc{{d}iii}ddc{{i}ddd}iiicicdc{{d}iii}dddc{{i}ddd}iiiicicdc{{d}iii}ddddc{{i}ddd}iiiiicicdc{{d}iii}dddddc{{i}ddd}iiiiiicicdc{{d}iii}ddddddc{{i}dd}dddcicdc{{d}ii}iiic{{i}dd}ddcicdc{{d}ii}iic{{i}dd}dcicdc

Try it online!

Stax, 6 bytes
╢#^↔2f

Run and debug it

Vyxal j, 12 bytes
kA:2l$Zƛfṅ;Ṫ

Try it Online!
Nice effort by @Ausername, +1 to them. I tried a different approach:
ka          # uppercase alphabet
:           # dup
2l          # pairwise
$           # swap
Z           # zip
ƛ           # map
 f          # flatten
 ṅ          # join
;           # close map
Ṫ           # slice without tail

Although not necessary, for beautification, I added the j flag.

Excel, 46 bytes
Multiple lines
=CONCAT(CHAR(ROW(65:89)*{1,1,1,0}+{0,1,0,10}))

One line
=CONCAT(CHAR(ROW(65:89)*{1,1,1,0}+{0,1,0,32}))

25 by 3 array of cells, 25 bytes
=CHAR(ROW(65:89)+{0,1,0})

I don't think this follows the spirit of the challenge but it is
shorter.

Uiua, 21 bytes
≡&p↘¯1⍉⍜⊙⊡↻.1↯3+@A⇡26

Pad

Uiua SBCS, 12 10 bytes
⊞+⇡25"ABA"

Try it!
-2 bytes thanks to Lynn!

⊞+⇡25"ABA" seems to work.

@Lynn Nice, thanks.

Pip -l, 7 bytes
BWR_MPz

Attempt This Online!
Explanation
BWR_MPz
      z ; Lowercase alphabet
    MP  ; Map this function to each adjacent pair of letters:
B       ;   The second letter
 WR     ;   Wrapped in two copies of
   _    ;   The first letter
        ; Autoprint the resulting list one element per line (-l flag)

SOGL V0.12, 7 bytes
ZZ«Z⁰Ij

Try it Here!

Standard ML (MLton), 62 bytes
fun$90=""| $n=implode(map chr[n,n+1,n,32])^ $(n+1);print($65);

Try it online!
Ungolfed:
fun f 90 = ""
  | f  n = implode(map chr[n,n+1,n,32]) ^ f(n+1);

print(f 65);

VBA, 40 Bytes
Anonymous VBE immediate window function that takes no input and outputs to the vbe immediate window.
For i=65To 89:a=Chr(i):?a;Chr(i+1)a:Next

Acc!!, 66 bytes
Count i while i-25 {
	i+65
	Write _
	Write _+1
	Write _
	Write 0
}

Try it online!

ReRegex, 50 bytes
>Z//>(.)(.)/$1$2$1 >$2/>ABCDEFGHIJKLMNOPQRSTUVWXYZ

Outputs in the form
ABA BCB CDC...

Try it online!

uBASIC, 64 bytes
0ForI=65To89:A$=Left$(Chr$(I),1):?A$;Left$(Chr$(I+1),1);A$:NextI

Try it online!

MY-BASIC, 48 bytes
For I=65 To 89
A=Chr(I)
Print A+Chr(I+1)+A;
Next

Try it online!

Visual Basic .NET (Mono), 105 bytes
Module M
Sub Main
Dim I,S
For I=65 To 89
S=Chr(I)
Console.WriteLine(S+Chr(I+1)+S)
Next
End Sub
End Module

Try it online!

Yabasic, 45 bytes
For I=65To 89
?Chr$(I)+Chr$(I+1)+Chr$(I)
Next

Try it online!

Vim, 29 keypresses
:h<_<CR>jjY<C-^>PVUqqy2llpi<CR><Esc>q25@qdj

PHP, 79 Bytes
Try it online!
Code (recursive function)
function f($l=25){if($l>0){echo chr($l+65).chr($l+64).chr($l+65)."
".f($l-1);}}

Explanation
function f($l=25){         #Running the function 25 times
    if($l>0){
        echo chr($l+65)    #start getting Z
            .chr($l+64)    # Y in the middle
            .chr($l+65)."  # with chr is still less bytes than str_pad
            ".f($l-1);     #call the function with $l-1
                           #in that call we get the line with YXY
                           #the result works because its writen in the
                           #inverted order of the stack :D
    }
}

Small Basic, 92 bytes
A Script that takes no input and outputs to the TextWindow Object
For I=65To 89
c=Text.GetCharacter(i)
TextWindow.WriteLine(c+Text.GetCharacter(i+1)+c)
EndFor

Try it at SmallBasic.com! Requires IE/Silverlight

PHP, 37 bytes
for($i=A;$i<Z;){echo$j=$i++,"$i$j
";}

Try it online!

Rockstar, 65 bytes
X's65
while X-90
cast X into C
let X be+1
cast X into N
say C+N+C

Try it here (Code will need to be pasted in)

Python 3, 60 bytes
for a in"abcdefghijklmnopqrstuvwxy":print(a+chr(ord(a)+1)+a)

Try it online!

Vyxal, 18 bytes
₄‹ʁ(⟨n|n›|n⟩kAİṅ,)

Try it Online!

Swift 5.9, 70 bytes
let f={$0%63>0 ?f($0-1333)+String($0,radix:36)+" ":""}
print(f(45358))

A direct Swift port of @Arnauld's JavaScript answer.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Create a regex to match a given range of integers in a given radix
Task
Write a program/function that, given three integers n,a,b prints a regular expression which matches all of the base-n integers from a to b (and no integers outside of that range).
Your algorithm should, in theory, work for arbitrarily large integers. In practice, you may assume that the input can be stored in your data type. (don't abuse native data type, that's a standard loophole)
Input
Three integers, n, a, b where n is in the range 1-32. a and b may be taken as base-n string/character list/digit list.
Output
A single string, represent the regex.
Rules

Base-n integers use the first n digits of 0123456789ABCDEFGHIJKLMNOPQRSTUV, you can choose to use upper-case or lower-case.
a and b may be negative, denoted by a - in front of the integer
You may assume a ≤ b.
Any regex flavor is allowed.
The behavior of the regex on strings not a base-n integer is undefined.

Winning criteria
Answers will be scored by the length of the code in bytes. (so code-golf rules apply)

Should we be able to match integers inside other text, or are we guaranteed they will be on their own?

Also, should we be able to match negative integers too? If so, how will the sign be represented?

Yes it should be able to match negative integers. Looks like that got edited out of the question.

You can assume the integer will be on its own

So, are negative integers represented with a - in the front or something else?

@EriktheOutgolfer  question updated

05AB1E, 17 bytes
ŸεD0‹'-×sÄIB«}'|ý

Try it online!
For some reason I don't seem to be able to replace I with ³.

Jelly, 24 bytes
ƓØBḣḊ;0
rµṠṾṖ$€ż⁸Aṃ¢¤j”|

Try it online!
Take 2 input from command line argument as decimal number, and base from stdin.

Looks like this doesn't work for negative numbers.

@EriktheOutgolfer Fixed.

Python 2, 157 bytes
n,a,b=input();s=o=''
for i in range(a,b+1):
 if i<0:i=abs(i);s='-'
 if i==0:o='0'+o
 while i:i,r=i/n,i%n;o=[`r`,chr(55+r)][r>9]+o
 o='|'+s+o;s=''
print o[1:]

Try it online!


text:
Foam Bath Letters
If you have a small child in your house, you may have come across foam bath letters. These can be moistened and stuck to flat surfaces such as tiles and the side of the bath to make words and messages.
The range of words and messages is somewhat limited if you only have one set though, since you only get 36 characters: uppercase letters A-Z, and digits 0-9: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. However, you can be cunning and abuse some of the letters and digits to form extra copies of other letters:
3: E
1: I
7: L (when rotated)
M: W (when rotated)
0: O
2: S (when flipped)
5: S
W: M (when rotated)
2: Z
5: Z (when flipped)
O: 0
6: 9 (when rotated)
L: 7 (when rotated)
9: 6 (when rotated)

Note that these are not all bi-directional, since it tends to be easier to read a digit as part of a word than a letter as part of a number.
Each set also comes in a range of colours, where each letter is coloured in sequence. For example, if your set has 3 colours, Red, Yellow and Blue, your set would be like:

Red: ADGJMPSVY147
Yellow: BEHKNQTWZ258
Blue: CFILORUX0369

Your task, therefore, is to take three parameters (in any suitable way) indicating a word or phrase, the number of colours to be used, and the number of sets you have, then to output a representation of the word or phrase, in a set of suitable colours, making use of substitutions if required. If it is not possible to make the word or phrase given the number of sets, instead output "Nope", in the appropriate colours.
Examples
In all of these, the first parameter is the word or phrase, the second is the number of colours, and the third is the number of sets available.
["bath", 3, 1]

["programming", 3, 2]

["puzzles", 3, 1]

["code golf", 5, 1]

["willow tree", 1, 1]

["impossible phrase", 8, 1]

 - there is only 1 P in a set, and no valid substitutions
Notes

You can default to 1 set if this helps (e.g. a default parameter value of 1), but you must support multiple sets if requested. The number of sets you have will always be a positive non-zero integer.
If you have multiple sets, they are all coloured in the same way: if A is red in the first set, it will be red in the second set too. The colours are applied per set, not to all sets in a given invocation
You must support 1 to 36 colours - 1 means all characters are the same colour, 36 means they are all distinct. There will only be integer numbers of colours.
You can use any colours, as long as they are visually distinct - if you are outputting to terminal, you can use a combination of foreground and background as a "colour", although you must not use the same colour for foreground and background
Your output must use the characters that you actually use, not the characters from the input. For example, if you had ["willow", 1, 1] as input, you could output WIL7OM with 7 and M rotated 180 degrees
You should use the correct letters first, then substitute: MI7LOW is incorrect for ["willow", 1, 1]
You can use any substitution for a given character: SO5 and SO2 with a flipped 2 are both valid for "SOS"
Multiple invocations of your code for the same input do not have to produce identical output
Output should be in uppercase, but input can be in any mix of upper and lower case
It should be obvious, but a space does not have a colour

Rules

This is code golf, but with semi-graphical output (I'm not sure if you can do flipped text in a terminal, but am interested to see if Pyth has a built in for it)
Standard loopholes apply
There are no bonuses for functions, but please vote up interesting answers
Include some screenshots of your output in your answers

Related Challenges

My Daughter's Alphabet - a partial inverse of this challenge, looking at finding a minimal set of letters to write a range of sentences
Does a letter fit inside the other? - about a different type of foam letters, but with a similar alternative to letters theme

What if it's not possible to output "NOPE" given the sets?

@Riker A set contains the 36 given characters. When would it be impossible to output NOPE?

@mypetlion when there's no sets...

@Riker Read "The number of sets you have will always be a positive non-zero integer."

Foam bath letters are a good introduction to leet speak...

HTML/JavaScript (with jQuery)/CSS - non-competing/non-golfed
Just to get the ball rolling, and show that it's not impossible, here is a non-golfed, non-competing implementation that takes a naive approach to the task.
It first creates a string of all the possible characters (tempalph), by joining as many copies of the alphabet as there are sets. Then it iterates through the phrase, putting each letter of the phrase into an output variable, and blanking the first instance of that letter from tempalph. If it can't (the letter doesn't exist), it checks if the letter is replaceable with something left in the string. If that also fails, it outputs a pre-defined "NOPE" output. Assuming it doesn't hit the "NOPE" case, it returns the output string and puts it into a DIV on the page.
It then loops through the base alphabet string, and if a letter has been used, assigns it an appropriate CSS class, each of which has a pre-defined colour set.
It uses HTML inputs for input, and updates on keyup in them.
Try it at JSFiddle
Example for ["BATH", 3, 1]:

JS:

var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

function getPhrase(phrase, sets){
    var modphrase = "";
  var nope = 'NOPE';
  var re = /^[A-Z0-9 ]+$/;
  if (re.test(phrase)){
    // might be valid - need to check there are enough characters available
    // At this point, need to look at specifically what characters are needed

    var tempalph = "";
    for ( var i=0; i'+char+'';
        if (tempalph.indexOf(char) != -1){
        tempalph = tempalph.replace(char, "#");
      } else {
        switch(char){
            case "E":
            if (tempalph.indexOf("3") != -1){
                    tempalph = tempalph.replace("3", "#");
              modchar = '3';
                } else {
                return nope;
            }
            break;
          case "I":
            if (tempalph.indexOf("1") != -1){
                    tempalph = tempalph.replace("1", "#");
              modchar = '1';
                } else {
              return nope;
            }
            break;
          case "L":
            if (tempalph.indexOf("7") != -1){
                    tempalph = tempalph.replace("7", "#");
              modchar = '7';
                } else {
              return nope;
            }
            break;
          case "M":
            if (tempalph.indexOf("W") != -1){
                    tempalph = tempalph.replace("W", "#");
              modchar = 'W';
                } else {
              return nope;
            }
            break;
          case "O":
            if (tempalph.indexOf("0") != -1){
                    tempalph = tempalph.replace("0", "#");
              modchar = '0';
                } else {
              return nope;
            }
            break;
          case "W":
            if (tempalph.indexOf("M") != -1){
                    tempalph = tempalph.replace("M", "#");
              modchar = 'M';
                } else {
              return nope;
            }
            break;
          case "0":
            if (tempalph.indexOf("O") != -1){
                    tempalph = tempalph.replace("O", "#");
              modchar = 'O';
                } else {
              return nope;
            }
            break;
          case "6":
            if (tempalph.indexOf("9") != -1){
                    tempalph = tempalph.replace("9", "#");
              modchar = '9';
                } else {
              return nope;
            }
            break;
          case "7":
            if (tempalph.indexOf("L") != -1){
                    tempalph = tempalph.replace("L", "#");
              modchar = 'L';
                } else {
              return nope;
            }
            break;
          case "9":
            if (tempalph.indexOf("6") != -1){
                    tempalph = tempalph.replace("6", "#");
              modchar = '6';
                } else {
              return nope;
            }
            break;

          case "S":
            if (tempalph.indexOf("5") != -1){
                    tempalph = tempalph.replace("5", "#");
              modchar = '5';
                } else if (tempalph.indexOf("2") != -1){
                    tempalph = tempalph.replace("2", "#");
              modchar = '2';
                } else {
              return nope;
            }
            break;
                    case "Z":
            if (tempalph.indexOf("2") != -1){
                    tempalph = tempalph.replace("2", "#");
              modchar = '2';
                } else if (tempalph.indexOf("5") != -1){
                    tempalph = tempalph.replace("5", "#");
              modchar = '5';
                } else {
              return nope;
            }
            break;
          case " ":
            break;
          default:
            return nope;
          }

      }
        modphrase += modchar;
    }

    return modphrase;
  } else {
    // contains some other characters, so definitely isn't valid
    return nope;
  }
}

function addColors(colcount){
  var i = 0;
  for (let char of alphabet){
    exclass = "."+char;
    newclass = "col"+i;
    if ($(exclass).length>0){
      $(exclass).addClass(newclass);
    }
    i++;
    if (i==colcount){
        i=0;
    }
  }
}

$("#phrase,#sets,#colours").on("keyup", function(){
    var phrase = $("#phrase").val().toUpperCase();
  phrase = getPhrase(phrase, $("#sets").val());
    $("#output").html(phrase);
  addColors($("#colours").val());
})

HTML:

Phrase<input type="text" id="phrase"/>
Colours<input type="text" id="colours" value="3"/>
Sets<input type="text" id="sets" value="1"/>

CSS:

.col0{ color: #f00 }
.col1{ color: #0f0 }
.col2{ color: #00f }
.col3{ color: #66CDAA }
.col4{ color: #EE82EE }
.col5{ color: #7FFFD4 }
.col6{ color: #7FFFD4 }
.col7{ color: #FFDEAD }
.col8{ color: #D8BFD8 }
.col9{ color: #FF6347 }
.col10{color: #8B4513 }
.col11{color: #800000 }
.col12{color: #00FFFF }
.col13{color: #32CD32 }
.col14{color: #191970 }
.col15{color: #1E90FF }
.col16{color: #A0522D }
.col17{color: #808000 }
.col18{color: #DC143C }
.col19{color: #90EE90 }
.col20{color: #D2691E }
.col21{color: #48D1CC }
.col22{color: #008000 }
.col23{color: #8B008B }
.col24{color: #6495ED }
.col25{color: #800080 }
.col26{color: #000080 }
.col27{color: #DB7093 }
.col28{color: #7FFF00 }
.col29{color: #00FA9A }
.col30{color: #0000FF }
.col31{color: #BC8F8F }
.col32{color: #A52A2A }
.col33{color: #4169E1 }
.col34{color: #FFFF00 }
.col35{color: #FFA07A }

.rot{ display: inline-block; transform: rotate(0.5turn);}
.flip{ display: inline-block; transform: rotateY(0.5turn);}

div{
  font-family: sans-serif;
  font-size: 3em;
  background-color: #000;
  padding: 10px;
}

I think non serious contender should be included in question, per this (mini) meta consensus.


text:
[CHRISTMAS THEME DISCLAIMER HERE]
Note to mods, if the title doesn't do justice, change it to whatever, I thought it was funny.

You're tasked with hanging up the lights for this Christmas season, and your family has decided that for it to be a merry Christmas, you need to hang at least 2 Christmas lights on your house. So, your challenge is, given a number 1 < n, output the corresponding number of christmas lights you're going to be hanging according to the following specifications...

Here is the structure of a basic christmas light:
  _?_
 [___]
 /:' \
|::   |
\::.  /
 \::./
  '='

The only uncertain part is the question mark, as depending on where the light lands in the chain, the connection will greatly differ.
For the first light in the chain, you will need to output:
    .--._
  _(_
 [___]
 /:' \
|::   |
\::.  /
 \::./
  '='

For the last light in the chain, you will need to output:
_.--.
    _)_
   [___]
   /:' \
  |::   |
  \::.  /
   \::./
    '='

And for all lights in the middle:
_.--.--._
   _Y_
  [___]
  /:' \
 |::   |
 \::.  /
  \::./
   '='

Example:
N=2:
    .--.__.--.
  _(_        _)_
 [___]      [___]
 /:' \      /:' \
|::   |    |::   |
\::.  /    \::.  /
 \::./      \::./
  '='        '='

N=6:
    .--.__.--.--.__.--.--.__.--.--.__.--.--.__.--.
  _(_       _Y_      _Y_      _Y_      _Y_       _)_
 [___]     [___]    [___]    [___]    [___]     [___]
 /:' \     /:' \    /:' \    /:' \    /:' \     /:' \
|::   |   |::   |  |::   |  |::   |  |::   |   |::   |
\::.  /   \::.  /  \::.  /  \::.  /  \::.  /   \::.  /
 \::./     \::./    \::./    \::./    \::./     \::./
  '='       '='      '='      '='      '='       '='

Credit
ASCII-Art was taken from: http://www.chris.com/ascii/index.php?art=holiday/christmas/other
It was developed by a user named "jgs", who is responsible for around 40% of content on that site.

Rules

Trailing spaces are fine, same with a trailing newline.
There is 1 more space between the first and last bulb from the rest of the chain.
You may only take 1 integer as input, and the output MUST be a string, no arrays.
Your program may have undefined functions for values less than 2.

This is ascii-artcode-golf, lowest byte-count wins.

Sanbox post link here.

What if strings are synonyms for arrays of characters?

That basic christmas light looks ridiculously similar to the grenade :)

@nicael Alternative challenge description: Santa is cracking down on bad kids this year, and for each naughty deed comitted the child will receive a live hand grenade. As the thoughtful provider of gifts that he is, Santa has tied the grenades together so the bad kids of the world won't lose them by accident!

@MagicOctopusUrn Uhm, 3 spaces on left and right and 2 spaces otherwise? I wish spacing was consistent. This is an ugly grenade belt.

@polkovnikov.ph it was either that, or the dots being over the parentheses (which looks strange), or the parentheses not being parentheses. IMO this is the best looking (though not the most golfable) approach.

SOGL V0.12, 73 71 70 66 bytes
.”L7:±¹‘Ο4↕ooā.⁾ Y*¾(){"}^ņF⁵),WοΓy⅜¬κ8ΕL▓‚7m~Ε⅝Γ‘7n┼F (=f⁄2=+⁽{@┼

Try it Here!
-4 bytes by looping over a string like (YYY) like the Charcoal answer
63 bytes would work if 2 didn't need to be handled :/

[mind blown.]

This is absolutely ridiculous. (Especially if it was done on a phone.) +1

I'm 90% sure I've seen this exact code before, from when I printed some uninitialized memory.

That's 113 bytes, 70 chars.

@polkovnikov.ph if you click the save SOGL codepage encoded file button, it gives you a 70 byte file, which you can load there too (albeit the browse button is unintuitively distant, fixing that). SOGL uses a custom codepage to do that. (the codepage is linked in the header of the answer)

Python 3, 200 195 191 190 186 bytes
d,*l=" _%c_     , [___]   , /:' \   ,|::   |  ,\::.  /  , \::./   ,  '='    ".split(',')
x=int(input())-2
print(' '*3,-~x*'.--.__.--'+'.\n',d%'(',d%'Y'*x,d%')')
for s in l:print(s,s*x,s)

-1 byte from dylnan
-4 bytes from Rod
Takes input on stdin.
Try it online!
Explanation:
d,*l=" _%c_     , [___]   , /:' \   ,|::   |  ,\::.  /  , \::./   ,  '='    ".split(',')
# d is the second row, without the (, Y, or ) to connect the light to the strand
# l is the third through eighth rows in a list
x=int(input())-2
# x is the number of lights in the middle of the strand
print(' '*3,-~x*'.--.__.--'+'.\n',d%'(',d%'Y'*x,d%')')
# print x+1 wire segments and a trailing dot, starting four spaces over
# on the next line, print the connectors, _(_, then _Y_ * x, then _)_
for s in l:print(s,s*x,s)
# on the Nth line, print the Nth light row, a space,
#     x * the Nth light row, a space, and the Nth light row

Additional Festive Version!

Changing the last line to for s in l:print(s,s*x,s) saves a byte.

Thanks for the explanation, Python looks bizarre to me ... lol

@ArtisticPhoenix Ironically, when not being golfed, Python is one the least bizarre looking languages.

Pyth, 113 107 bytes
+"    ."*=tQ"--.__.--."++"  _(_ "j"_Y_"*Q]*6d" _)_"jms[d;jd*Q]*2;;d)c5" /:' \ |::   |\::.  / \::./   '='  "

Try it online!
Not exactly the golfiest version...

Not golfy? Maybe. Correct? Yes. FGITW? Definitely.

Yeah, not the golfiest, especially with an unnecessary trailing character. :P

JavaScript (ES6), 180 bytes
n=>`    .${'--.__.--.'.repeat(n-1)}
`+`  _Y_
 [___]
 /:' \\
|::   |
\\::.  /
 \\::./
  '='  `.replace(/.+/g,(r,p)=>`${p?r:'  _(_  '}  ${` ${r} `.repeat(n-2)}  ${p?r:'  _)_'}`)

Test

var f=
n=>`    .${'--.__.--.'.repeat(n-1)}
`+`  _Y_
 [___]
 /:' \\
|::   |
\\::.  /
 \\::./
  '='  `.replace(/.+/g,(r,p)=>`${p?r:'  _(_  '}  ${` ${r} `.repeat(n-2)}  ${p?r:'  _)_'}`)

function update()
{
  var n=+I.value
  P.textContent=f(n)
}

update()
<input id=I type=number value=2 min=2 oninput='update()'>

Excel VBA, 224 207 205 Bytes
Anonymous VBE immediate window function that takes input from range [A1] and outputs to the VBE immediate window.
Prints the bulbs line by line, from top left to bottom right
?Spc(4)[Rept(".--.__.--",A1-1)]".":?"  _(_ "[Rept("      _Y_",A1-2)]"       _)_":For i=0To 5:b=Split(" [___]   1 /:' \   1|::   |  1\::.  /  1 \::./   1  '='    ",1)(i):[B1]=b:?b" "[Rept(B1,A1-2)]" "b:Next

Sample I/O
[A1]=7 ''  Input to worksheet, may also be done manually
?Spc(4)[Rept(".--.__.--",A1-1)]".":?"  _(_ "[Rept("      _Y_",A1-2)]"       _)_":For i=0To 5:b=Split(" [___]   1 /:' \   1|::   |  1\::.  /  1 \::./   1  '='    ",1)(i):[B1]=b:?b" "[Rept(B1,A1-2)]" "b:Next
    .--.__.--.--.__.--.--.__.--.--.__.--.--.__.--.--.__.--.
  _(_       _Y_      _Y_      _Y_      _Y_      _Y_       _)_
 [___]     [___]    [___]    [___]    [___]    [___]     [___]
 /:' \     /:' \    /:' \    /:' \    /:' \    /:' \     /:' \
|::   |   |::   |  |::   |  |::   |  |::   |  |::   |   |::   |
\::.  /   \::.  /  \::.  /  \::.  /  \::.  /  \::.  /   \::.  /
 \::./     \::./    \::./    \::./    \::./    \::./     \::./
  '='       '='      '='      '='      '='      '='       '='

-17 Bytes thanks to @YowE3k
-2 bytes for addition of temporary variable b

Ooh I love answers in paperwork-software macro languages! On the other hand I  lost to VBA. +1

(You got me to sign up, just so I can leave this comment!)  The : [Rept(B1,A1-2)] just before the start of the loop isn't used.

@YowE3K - You are right! Thanks for catching that - its been corrected

JavaScript (ES6), 204 201 196 194 192 bytes
N=>`     ${(r=x=>x.repeat(N-1))(`.--.__.--`)}.
   _(_    ${N--,r(`   _Y_   `)}    _)_
`+` [___]
 /:' \\
|::   |
\\::.  /
 \\::./
  '='  `.split`
`.map(x=>`${x=` ${x} `} ${r(x)} `+x).join`
`

f=

N=>`     ${(r=x=>x.repeat(N-1))(`.--.__.--`)}.
   _(_    ${N--,r(`   _Y_   `)}    _)_
`+` [___]
 /:' \\
|::   |
\\::.  /
 \\::./
  '='  `.split`
`.map(x=>`${x=` ${x} `} ${r(x)} `+x).join`
`

for(let i = 2; i <= 5; i++){
  console.log(f(i))
}

You can save a few characters by replacing .--._${(r=x=>x.repeat(N-2))(\.--.--.`)}_.--.with${(r=x=>x.repeat(N-1))(`.--.__.--`)}.`

@KuilinLi I'd have to decrement N after the first call to r, but that works out fine.

Charcoal, 78 74 bytes
Ｍ⁴→×….--.__⁹⊖θ.⸿Ｆ⪫()×Y⁻θ²«Ｍ⁼ι)→Ｐ“ ▷υ ρ1↗N⁷Σ⭆ C✂⪪⟲⦃¬≡↘↨H℅⌕Σêλ⍘”  _ι_Ｍ⁺⁴⁼ι(→

Try it online! Link is to verbose version of code. Edit: Saved 2 bytes by simplifying the way the wiring is printed. Saved 2 bytes because the new code automatically casts the input to integer. Explanation:
Ｍ⁴→×….--.__⁹⊖θ.⸿

Print the wiring by taking the string .--.__, moulding it to length 9, then repeating it once for each join, finishing with a final . before moving to the start of the next line for the bulbs.
Ｆ⪫()×Y⁻θ²«

Loop over a string of connectors: ( and ) at the ends, and Ys in the middle.
Ｍ⁼ι)→

Move right one character if this is the last bulb.
Ｐ“ ▷υ ρ1↗N⁷Σ⭆ C✂⪪⟲⦃¬≡↘↨H℅⌕Σêλ⍘”

Print the body of the bulb without moving the cursor.
  _ι_

Print the cap of the bulb including the connector.
Ｍ⁺⁴⁼ι(→

Move to the start of the next bulb (an extra character if this is the first bulb).

That's 74 chars, not bytes.

@polkovnikov.ph Charcoal uses a custom codepage, allowing it to count each character as a single byte.

C,  279   278   272   262  259 bytes
Thanks to @NieDzejkob for saving six bytes!
#define P;printf(
i,j;f(n){char*S=" [___]   \0 /:' \\   \0|::   |  \0\\::.  /  \0 \\::./   \0  \'=\'    \0"P"    ");for(i=n--;--i P".--.__.--"))P".\n  _(_ ");for(;++i<n P"      _Y_"))P"       _)_\n%s ",S);for(;*S P"%10s\n%s ",S,S+10),S+=10)for(i=n;--i P S));}

Try it online!
Unrolled:
#define P;printf(

i, j;

f(n)
{
    char*S = " [___]   \0 /:' \\   \0|::   |  \0\\::.  /  \0 \\::./   \0  \'=\'    \0"
    P"    ");

    for (i=n--; --i P".--.__.--"))
    P".\n  _(_ ");

    for (; ++i<n P"      _Y_"))
    P"       _)_\n%s ",S);

    for (; *S P"%10s\n%s ", S, S+10), S+=10)
        for(i=n; --i P S));
}

C, wonderful! (:

272 bytes

Java, 310 307 300 275 bytes
Thanks to DevelopingDeveloper for converting it to a lambda expression
i->{int j=1;String o="     .";for(;j++2;)o+="   _Y_   ";o+="    _)_";String[]a={"  [___]  ","  /:' \\  "," |::   | "," \\::.  / ","  \\::./  ","   '='   "};for(String b:a)for(j=0;j++
{
    int j=1;
    String o="     .";
    for(;j++2;)
        o+="   _Y_   ";
    o+="    _)_";
    String[]a={"  [___]  ","  /:' \\  "," |::   | "," \\::.  / ","  \\::./  ","   '='   "};
    for(String b:a)
        for(j=0;j++<i;)
            o+=j==1?"\n"+b+" ":j==i?" "+b:b;
    return o;
};

Looking into shorter ways to multiply strings, and found that streams are surprisingly more verbose
Try it online!

String o=""; + o+="     ."; = String o="     .";

@manatwork Thanks, missed that

@Steadybox had an off by 1 error while golfing the for loops, fixed now (and actually saved a byte from it)

@phflack I got it down to 290 if you use a lamda expression

@DevelopingDeveloper Are lambdas allowed in this case, or would the interface also have to be counted?  (and that's a neat way to save a few bytes)

@phflack Unless they say "complete programs" I always just submit the lambda expression with a Java answer. You can ask the OP, but really the only code you have is within the brackets of the lamda, everything else is just a formality. And we are already at a disadvantage using Java, so we will save as many bytes as we can! :P

@phflack Also, the OP said it just needs to return the String, not print it to the console, so you can drop it down to 279 doing this

@DevelopingDeveloper Cool, I also found a way to golf j=# out of the for loops

@DevelopingDeveloper: 1 byte less if you use a lmda expression. Sorry.

272 bytes

PHP, 276, 307, 303, 301, 293, 283, 280, 278 Bytes
function g($n){$a=["     .--._".r("_.--.--._",$n)."_.--.",r("_(_")." ".r(_Y_,$n)." ".r("_)_")];foreach(explode(9,"[___]9/:' \9|::   |9\::.  /9\::./9'='")as$b)$a[]=r($b)." ".r($b,$n)." ".r($b);return join("\n",$a);}function r($s,$n=3){return str_repeat(str_pad($s,9," ",2),$n-2);}

Readable version for testing:
function g($n){
    $a=[
         "     .--._".r("_.--.--._",$n)."_.--.",
         r("_(_")." ".r(_Y_,$n)." ".r("_)_")
    ];

    foreach(explode(9, "[___]9/:' \9|::   |9\::.  /9\::./9'='") as$b)
         $a[]=r($b)." ".r($b,$n)." ".r($b);

    return join("\n",$a);
}
function r($s,$n=3){
    return str_repeat(str_pad($s,9," ",2),$n-2);
}

Check minified version out here
Check readable version out here
UPDATE
Wrapped it in a function,

Let us continue this discussion in chat.

The old JavaScript tip of using digit as delimiter works fine in PHP too, just that you will have to escape the \  before the separator digit, so will save only 1 char. You can save another 2 chars by making the space characters part of the same bigger string, containing the expression in the middle as expansion: $a[]=$r($b)." {$r($b,$n)} ".$r($b);.

@manatwork - thanks for the tip Updated

@manatwork - also if I use a 9 as the delimiter no escaping is needed, probably this works with other numbers just not 0

Ah, indeed. Only 8 and 9 need no escaping when preceded by \  as those 2 can not be confused with octal character code. Good to know, thanks.

I could save a few with split() instead of explode() but in PHP7 it's removed, that's because split takes a Regx like pattern, similar to Javascripts Split, where explode takes a string.  For instance join is an alias of implode but split is more like preg_split. I think split was a holdover from the ereg ( POSIX ) days.

Why do you use braces around ($n-2)? It works just fine without those. Another -2 bytes ;)

And another one is that you could define the $r() lambda function as a regular function r() (could be in the same place, function in function is possible). You do need to fix the string parsing: " {r("")} " won't work. Another -7 bytes ;)

Thanks, had to do it as a separate function because its called by a loop.  Basically it re-defines the function on each itteration

I eliminated a further 10 by removing the function calls on the outside of the first line.

Instead of r("_Y_",$n), you can use r(_Y_,$n) and ignore the warning. Your bytecount is incorrect: You're counting the newline as 2 characters, when they are counted as 1. All newlines are assumed to be a \n, unless the person posting says otherwise. You can make it shorter: function r($s,$n=3){return str_repeat(str_pad($s,9," ",2),($n-2));};$a=["     .--._".r("_.--.--._",$n=$argv[1])."_.--.",r("_(_")." ".r(_Y_,$n)." ".r("_)_")];foreach(explode(9,"[___]9/:' \9|::   |9\::.  /9\::./9'='")as$b)$a[]=r($b)." ".r($b,$n)." ".r($b);echo join("\n",$a); (272 bytes), but isn't a function now.

Someone said it had to be a function, before.  But thanks on the other ones.

@7ochem - sorry I missed your comment, I use the ( ) out of habit for readability reasons.  Obviously that has little value here.

Clean, 305 292 288 275 bytes
import StdEnv
f c=mklines['  _',c,'_  \n [___] \n /:\' \\ \n|::   |\n\\::.  /\n \\::./ \n  \'=\'  ']
@n=flatlines[a++b++c\\a<-[['    .--._']:[e++['  ']\\e<-f'(']]&b<-map(flatten o(repeatn(n-2)))[['_.--.--._']:[[' ':e]++[' ']\\e<-f'Y']]&c<-[['_.--.    ']:[['  ':e]\\e<-f')']]]

Try it online!

Python 2 (PyPy), 365 316 315 251 245 bytes
-21 thanks to FlipTack
-43 thanks to ovs
-6 thanks to Mr. Xcoder

v,p=' \n'
a,l,n=".--._",["[___]"," /:' \ ","|::   |","\::.  /"," \::./ ","  '='  "],input()-2
e,b=v*5+"_)_",a[::-1]
r=v*4,a,(b[:4]+a)*n,b,p+"  _(_   ",(v*4+"_Y_  ")*n,e+p+v
for i in l:b=4-2*(i in l[1:]);r+=i+v*-~b,(i+v*b)*n,v+i+p
print''.join(r)

Try it online!

-21 bytes

245 bytes.

I think you forgot to update the bytecount after editing in the last suggestion.

Kotlin, 261 bytes
{val c="  [___]\n/:' \\\n |::|\n \\::./\n  \\::./\n   '='"
(0..7).map{i->print("     .--._\n   _(_\n$c".lines()[i].padEnd(10))
(0..L-3).map{print("_.--.--._\n   _Y_\n$c".lines()[i].padEnd(9))}
if(i>1)print(' ')
print("_.--.\n    _)_\n$c".lines()[i])
println()}}

Beautified
{
    val c = "  [___]\n  /:' \\\n |::   |\n \\::.  /\n  \\::./\n   '='"

    (0..7).map {i->
        print("     .--._\n   _(_\n$c".lines()[i].padEnd(10))
        (0..L - 3).map {
            print("_.--.--._\n   _Y_\n$c".lines()[i].padEnd(9))
        }
        if (i > 1) print(' ')
        print("_.--.\n    _)_\n$c".lines()[i])
        println()
    }
}

Test
fun f(L: Int)
{val c="  [___]\n/:' \\\n |::|\n \\::./\n  \\::./\n   '='"
(0..7).map{i->print("     .--._\n   _(_\n$c".lines()[i].padEnd(10))
(0..L-3).map{print("_.--.--._\n   _Y_\n$c".lines()[i].padEnd(9))}
if(i>1)print(' ')
print("_.--.\n    _)_\n$c".lines()[i])
println()}}

fun main(args: Array<String>) {
    f(6)
}

TIO
TryItOnline

Google Sheets, 190 Bytes
Anonymous worksheet function that take input from range A1 and outputs to the calling cell
="    "&Rept(".--.__.--",A1-1)&".
  _(_    "&Rept("   _Y_   ",A1-2)&"    _)_"&RegexReplace("
 [___]
 /:' \
|::   |
\::.  /
 \::./
  '='
","
(.*)","
$1 "&Rept("$1",A1-2)&" $1


text:
Let's write a Minifier
Background
Minifiers are used, commonly, when serving JavaScript to your Web Browser.  It is commonly used to reduce the number of bytes that have to be sent.  Saving bandwidth is useful for obvious reasons.  Some people use obfuscaters (that intentionally make code harder to read), I am not talking about those.
We will be minifying Python 2
I was debating on whether or not use JavaScript or Python for the minifying experience and I decided on Python for two reasons: white space matters and I think that will add an interesting dynamic the problem.  Additionally, using Python 2.7 will provide another dynamic, such as remove superfluous () during a print (i.e. print("Hello world") vs. print"Hello world"). I would have, personally, preferred to open it up to any language, but for some languages this process won't make a lot of sense for.  And, what language you decide to minify will directly impact your score (and if the language even can be minified).
Specs
Your goal is to only modify the code in a way that will not change it's functionality in anyway.  You may, of course, change variable names (inside your minifying program) as long as it doesn't effect output (keep track of scope).  Although I am giving you a specific program, please don't optimize for the test case as all standard loopholes are forbidden.
Score: length of the program after you minified it.
Input: Any Python 2.7 program (that contains no errors)
Output: A minified version.
Although your code should be able to accomodate all valid Python 2.7 input, it is necessary to test your script against something in order to prove it's effectiveness.
Click here to view the example program.
Making the problem more approachable
Feel free to use or modify any code found inside my solution (listed bellow). I did this to get you started with quote basic quote handling; however, you can expand it to indentation, and etc.
Example ways to minify Python
All white space could be replaced with the minimum possible amount (I acknowledge that in Python you can do some tricky stuff with tabs, but I'll leave that up to you to decide whether or not to implement it).
Example
The following:
def print_a_range(a):
    for i in range(a):
        print(i)

Could be:
def print_a_range(a):
 for i in range(a):
  print(i)

Technically, if there is only one line inside a loop, you can compress it even more:
def print_a_range(a):
 for i in range(a):print(i)  #Note, you can also remove the `()` here.

However, there is another way you can minify white space in Python:
The following:
print ([a * 2 for a in range(20) if a % 2 == 0])

Could be:
print([a*2for a in range(20)if a%2==0])

Note, that there is no need for a space between 2 and for.  Variable, functions, and keywords cannot start with a number.  So, the Python interpreter is okay with <num><keyword>, no space.  You should also note there does not have to a space between ) and if.
Note, you must not change the output of the program! So:
print"f(x)=x*2 is a great equation!"

The above print statement should stay the same because removing the space between 2 and is would modify the output.

Sandbox: https://codegolf.meta.stackexchange.com/a/14424/67929

Sidenote: there is no program that can output the shortest equivalent of any arbitrary input program, per this discussion

There do be some python minifier tools already. I dont think this question may receive better solution than the already exits tools.

Is changing '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' into '1'*100 allowed? Require to do as the behavior is same?

Python 2.7, 2013 score
This program can be used as reference, and you are allowed to take the following code and modify it and then post it in your own solutions.
In hindsight, I maybe should have used regex for the quote handling too, but I think in its current state it may be enough to jump-start people into the problem.
Why I chose Python 2.7:  I thought it would be easier to test to see if I made the program crash via the exec keyword.
This code intakes the program as in.txt.
I figured I should at least get the ball rolling for whoever want to participate by writing a quote parser (that also happens to handle comments) and a brief example on how regex, when combined with the quote parser can really change the game in terms of complexity of this problem.
Note: there is still plenty of room for improvement in this minifier.  Like you could play around with indentation, variable names, and removing the parenthesis when they're being used my keywords, like print or yield.
import re

with open("in.txt","r") as fi:
    code = fi.read()

class QuoteHandler():
    def __init__(self):
        pass
    def loadCode(self,code):
        quoteFlag = False
        currentQuoteChar = ""
        ignoreNext = False
        inEndLineComment=False
        startLocation = 0

        self.reAddStrings = []

        outStr = ""

        for i, character in enumerate(code):
            if ignoreNext:
                ignoreNext = False
            elif inEndLineComment:
                if character in "\r\n":
                    inEndLineComment=False
            elif character == "#" and not quoteFlag:
                inEndLineComment = True
            elif character in "'\"" and (currentQuoteChar == character or not quoteFlag):
                if quoteFlag:
                    self.reAddStrings.append(code[startLocation+1:i])
                else:
                    currentQuoteChar = character
                    startLocation = i
                quoteFlag = not quoteFlag
            elif character == "\\":
                ignoreNext = True

            if not inEndLineComment and not quoteFlag:
                outStr+=character
        return outStr

    def find_all_locations(self,substr,code):
        return [m.start() for m in re.finditer(substr, code)]

    def unloadCode(self,code):
        temp = self.reAddStrings[::-1]
        for i, location in enumerate(list(self.find_all_locations('"',code))[::-1]):
            code = code[:location] + "\"" + temp[i] + code[location:]
        return code

def applyRegexes(code):#\w here?
    operatorRegexCleaner = ["([\d\/*\-\"=,'+{}:[\](\)])","[ \t]+","(\w)"]
    regexes = [
        [''.join(operatorRegexCleaner),r"\1\2"],
        [''.join(operatorRegexCleaner[::-1]),r"\1\2"],#removes whitespace between operators
        ["\n\s*\n","\n"]#removes empty lines
    ]
    for regex in regexes:
        code = re.sub(regex[0],regex[1],code)
    return code

qh = QuoteHandler()
code = qh.loadCode(code)
code = applyRegexes(code)
code = qh.unloadCode(code)
print(code)
exec(code)

Output of program:
def factor(factor_number):
    for n in range(2,factor_number):
        if factor_number % n==0:
            yield(n)
def gcd(a,b):
    """Calculate the Greatest Common Divisor of a and b.

    Unless b==0, the result will have the same sign as b (so that when
    b is divided by it, the result comes out positive).
    """
    while b:
         a,b=b,a%b
    return a
class Apricot:
    def __init__(self):
        self.mold=False
    def get(self):
        return self.mold
    def update(self):
        self.mold=not self.mold
    def blue(self):return5
def tell_me_about_these_numbers(*a):
    print("%d is the first number!" % a[0])
    print("{} / 3 is {}".format(a[0],a[0]/3.))
    myFavorate=Apricot()
    for number in a:
        print list(factor(number))
        myFavorate.update()
    print[gcd(a,b)for a,b in zip(a[:-1],a[1:])]
    print(myFavorate.get())
tell_me_about_these_numbers(5,6,9,45,200)
print"Let's play with scope!"
a,b=10,9
def randomFunction(a):
    print(a)
randomFunction(b)
print(a)
for a in range(100):
    b+=a
print(a)
print(b)
li=[]
for i in range(10):
 li.append(i*2)
print(li)
print([i*2for i in range(10)])
a=c=b=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=w=x=y=z=5
print(a)
a-=1
print(a)
g=10
print(str(10**g+5)[::-1])
def blue_fish(a):
    def blue_fish(a):
        def blue_fish(a):
            return a
        a+=1
        return blue_fish(a)
    a-=1
    return blue_fish(a)
print(blue_fish(10))
def blue_fish(a):
    if a==0:
        return"0"
    return"1" +blue_fish(a-1)
print(blue_fish(5))
blue_fish=lambda a,b,c:a*b*c
print(blue_fish(1,2,3))
blue_fish=lambda*a:reduce(lambda a,b:a*b,a)
print(blue_fish(1,2,3))
print(max([[6,1],[5,2],[4,3],[3,4],[2,5],[1,6]],key=lambda a:a[1]))
print(zip(*[[1],[2],[3],[4],[5]]))
print"Now let's test to see if you handle quotes correctly:"
print"test \'many diffent\' \"types of \" quotes, even with \' \" trailing quotes"
print"""

Multi line quotes are great too!

"""
a=""" ::
one more multi-line quote won't hurt
"""
print a