[Question]
  [
[Inspired by this](https://codegolf.stackexchange.com/questions/53675/calculate-average-characters-of-string)
# Task
Your task is to output the average character of your code.
## What is an average character?
Say we have a string `golf()`.
We then take the ASCII value of each separate symbol, so our string is `103 111 108 102 40 41`, and calculate the average of those values, rounded to an integer. In our case the average is `505 / 6 = 84.1666... = rounded to 84`. That value is printed out as an ASCII character, in our case `T`.
# Rules
You must take no input and must not read the source code directly, while outputting the average character of its source code. Integers are rounded by function `floor(x+0.5)`. Empty programs are not allowed. This is code-golf, so lowest byte count wins!
  
[Answer]
# [///](https://esolangs.org/wiki////), 1 byte
```
A
```
[Try it online!](https://tio.run/##K85JLM5ILf7/3/H/fwA "/// – Try It Online")
As it is 1 byte, simply outputting the source code gives the average. `///` just outputs the source code unchanged if it doesn’t contain any `/` characters, so almost any ASCII character works in place of `A`
[Answer]
# [Unreadable](https://esolangs.org/wiki/Unreadable), 111 bytes
> 
> '"'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'"""
> 
> 
> 
[Try it online!](https://tio.run/##K80rSk1MSUzKSf3/X11JXYl@SOn/fwA "Unreadable – Try It Online") or [Check average](https://tio.run/##K6gsycjPM/7/v1jBViEzr6C0REOTqyS/JDEHyC8uzdXIL0rRSNZUSMsvUkgGKlAo1uQqKMrMK9FIzijSANEGeqYK2gpgLfo5qXkaxZpA8P@/upK6Ev2QEgA "Python 3 – Try It Online")
Note that the average character is `$` and does not appear in the source code, which contains only 37 `'`s and 74 `"`s.
[Answer]
# [Malbolge](https://github.com/TryItOnline/malbolge), 17 bytes
```
(=<;:9876543210TA
```
[Try it online!](https://tio.run/##y03MScrPSU/9/1/D1sbaytLC3MzUxNjI0CDE8f9/AA "Malbolge – Try It Online")
[Test the code average](https://tio.run/##K6gsycjPM/7/v1jBViEzr6C0REOTqyS/JDEHyC8uzdXIL0rRSNZUSMsvUkgGKlAo1uQqKMrMK9FIzijSANEGeqYK2gpgLfo5qXkaxZpA8P@/hq2NtZWlhbmZqYmxkaFBiCMA)
Explanation:
```
(=<;:9876543210TA
(                    Copies the value pointed by register d to register d.
                     (d = 0 so it copies the '(' ASCII value)
 =<;:9876543210      Succesive calls to the crazy operation to update the value
                     in register a until the value stored meets the code average
               T     Prints the value in a
                A    Ends the program
```
Luckily this time we don't need to cope with Malbolge's code encryption feature.
[Answer]
# [HQ9+](https://esolangs.org/wiki/HQ9+) Family, 1 bytes
```
Q
```
Believe it or not, there are challenges can be solved by HQ9+ in 2020.
[Answer]
# [Python 2](https://docs.python.org/2/), 8 bytes
```
print"Y"
```
[Try it online!](https://tio.run/##K6gsycjPM/r/v6AoM69EKVLp/38A "Python 2 – Try It Online")
[Average Character Verified](https://tio.run/##K6gsycjPM/7/v1jBViEzr6C0REOTqyS/JDEHyC8uzdXIL0rRSNZUSMsvUkgGKlAo1uQqKMrMK9FIzijSANEGeqYK2gpgLfo5qXkaxZpA8P8/WJFSpBIA)
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/) and lots of other languages and REPLs, 1 byte
```
4
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKO94L8JiPqvAAYFAA "APL (Dyalog Unicode) – Try It Online")
---
However, more interesting is:
```
''''
```
Which actually evaluates to the single quote. [Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKO94L86EIBY/xXAoAAA "APL (Dyalog Unicode) – Try It Online")
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 15 bytes
```
+[+++++>+<]>++.
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fO1obBOy0bWLttLX1/v8HAA "brainfuck – Try It Online")
Requires an 8 bit interpreter as it uses modulo 256 arithmetic.
Average is 53.4. Outputs `5` which is character 53.
[Answer]
# [COW](https://bigzaphod.github.io/COW/), ~~11~~ 8 bytes
```
BOOM!!
```
[Try it online!](https://tio.run/##S84v///fyd/fV1GRi@v/fwA "COW – Try It Online") or
[verify the average](https://tio.run/##K6gsycjPM/7/v1jBVkHJyd/fV1ExJi8mT4mrJL8kMQcoWFyaq5FflKKRrKmQll@kkKyQmadQrMlVUJSZV6KRnFGkAaIN9EwVtBXAWvRzUvM0ijWB4P9/AA).
Explosively prints `0` (average 48.375), using the fact that all non-instructions (`B`, `!!`, and the two newlines) are no-ops.
### 6 bytes
I'm retaining the 8-byte version above because it's my favourite, but here's a 6-byter thanks to @JoKing:
```
OOM!        
```
(Note the code ends with two tabs.) Also prints `0` (average 47.66...).
And here's another, with an average of exactly 48:
```
OOM!
```
---
# [COW](https://bigzaphod.github.io/COW/), ~~87~~ 78 bytes
```
MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMOOMMMMOOmoOMoOmOoMOomooMMMMOomoomoOMoo
```
[Try it online!](https://tio.run/##S84v///fN9@fKOTv7wsE/v65YG6uf76vf35ufj5YEMQAi@f//w8A "COW – Try It Online") or [verify the average](https://tio.run/##jUtLCsMgFNznFG/5JNAWQpY5grwzFNugEB3Rl0VPb4wn6DAwH2byTz3S0lqljULKp7KZFPo@eq5nZJQPO0M7Crk@oGqmXEJSdr7wra/HSjONy/P4Jq6mozUL@YsitkMkjhgFVhCBUd5m9LgA).
No no-ops this time. Prints `[` (average 90.54...) by counting up to 91.
### Commented
```
MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoO    push 13 to first memory block
MOO        begin outer loop
  MMM      copy value to register
  MOO      begin inner loop
    moO    switch to second memory block
    MoO    increment                                  
    mOo    switch to first memory block
    MOo    decrement
  moo      end inner loop
  MMM      paste register value into first memory block
  MOo      decrement
moo        end outer loop
moO        switch to second memory block
Moo        print as ASCII character
```
[Answer]
# [R](https://www.r-project.org/), 8 bytes
```
cat("B")
```
[Try it online!](https://tio.run/##K/r/PzmxREPJSUnz/38A "R – Try It Online") or [Check average](https://tio.run/##HYtBCoAgEEX3nmJwNUNQQbRs001kKhRMRcdFpzfrbx4P3k@P2BiW1gps4EKqgqQkivHdS70x5gOZ4IoZuAdQSKXsgiDbjB/ncYUB/svkz4CF@lpjI6h3TS8 "Python 3 – Try It Online")
or
```
cat('C')
```
[Try it online!](https://tio.run/##K/r/PzmxREPdWV3z/38A "R – Try It Online") or [Check average](https://tio.run/##HYtBCoAgEEX3nmJ2zhBUEC1bdRKZCgVT0XHR6c36m8eD99MjNoaltQIbuJCqICmJYnz3Um@M@UAmuGIG7gEUUim7IMg248d5XGGA/zL5M2ChvtbYCOpd0ws "Python 3 – Try It Online")
Also,
```
cat(8)
```
(with 2 null bytes) doesn't work on TIO, but works in RStudio on my Kubuntu machine.
[Try it online!](https://tio.run/##K/r/PzmxRIPRglHz/38A "R – Try It Online") or [Check average](https://tio.run/##HYtBCoAgEEVx6ylmOUNQQQRtOoxMhYKp6Ljo9Gb9zePB@@kRG8PSWoEdXEhVkLREMb57qTfGfCATXDED9wAK6ZRdEGSb8eM8rjDAf5n8GbBQX2tsBDdS6gU "Python 3 – Try It Online").
[Answer]
# [Pyramid Scheme](https://github.com/ConorOBrien-Foxx/Pyramid-Scheme), 29 bytes
```
   ^
  / \
 /out\
^-----
-
 
```
[Try it online!](https://tio.run/##K6gsSszNTNEtTs5IzU39/19BQSGOS0FBXyGGS0E/v7QkhitOFwS4dLm4FP7/BwA "Pyramid Scheme – Try It Online")
This has an average of ~48.137, so this outputs `0`.
If we're allowed a trailing newline, then we can get 4 bytes
```
^,
-
```
[Try it online!](https://tio.run/##K6gsSszNTNEtTs5IzU39/z9Oh0v3/38A "Pyramid Scheme – Try It Online")
Again, this outputs `0`, but by printing the return of the pyramid, which has an extra newline
[Answer]
# [cat](https://en.wikipedia.org/wiki/Cat_%28Unix%29), 1 byte
```
a
```
If your challenge can be competitively solved with `cat`, there is probably something wrong with the challenge.
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 1 byte
```
0
```
[Try it online!](https://tio.run/##K0otycxL/P/f4P9/AA "Retina 0.8.2 – Try It Online") Works by counting the number of `0`s in the input. This can of course be extended to any arbitrary number of bytes just by repeating the number of `0`s, or substituting other characters which happen to have an average byte value of `0`, e.g. `.2`, as long as the result remains a valid regular expression that doesn't match the empty string.
Without using a Match (count) stage, I think the minimum possible is 3 bytes:
```
^
4
```
This program outputs `4`, whose ASCII code `52` is the average of `94` (for `^`) and `10` (for the newline).
[Answer]
# [Perl 5](https://www.perl.org/) + `-M5.10.0`, 67 bytes
I know this isn't the shortest, but I think it's what OP was after.
```
$_=q{$_="\$_=q{$_};eval";$-+=ord for/./g;say chr(.5+$-/y///c)};eval
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3rawGkgoxUBZtdapZYk5StYqutq2@UUpCmn5Rfp6@unWxYmVCskZRRp6ptoquvqV@vr6yZoQtf///8svKMnMzyv@r@trqmdooGcAAA "Perl 5 – Try It Online")
[Answer]
# [Lost](https://github.com/Wheatwizard/Lost), ~~19~~ ~~13~~ 11 bytes
```
v<<<<
>%(9@
```
-6 bytes thanks to *@JoKing*.
The average is 57.090..., which will be rounded to 57 (character `'9'`).
[Try it online](https://tio.run/##y8kvLvn/v8wGCLjsVDUsHf7/BwA) or [verify that it's deterministic](https://tio.run/##y8kvLvn/v8wGCLjsVDUsHf7//68bBgA).
### Explanation:
**Explanation of the language in general:**
Lost is a 2D path-walking language. Most 2D path-walking languages start at the top-left position and travel towards the right by default. Lost is unique however, in that ***both the start position AND starting direction it travels in is completely random***. So making the program deterministic, meaning it will have the same output regardless of where it starts or travels, can be quite tricky.
A Lost program of 2 rows and 5 characters per row can have 40 possible program flows. It can start on any one of the 10 characters in the program, and it can start traveling up/north, down/south, left/west, or right/east.
In Lost you therefore want to lead everything to a starting position, so it'll follow the designed path you want it to. In addition, you'll usually have to clean the stack when it starts somewhere in the middle.
**Explanation of the program:**
All arrows will lead the path towards the leading `>` on the second line. From there the program flow is as follows:
* `>`: travel in an east/right direction
* `%`: Put the safety 'off'. In a Lost program, an `@` will terminate the program, but only when the safety is 'off'. When the program starts, the safety is always 'on' by default, otherwise a program flow starting at the exit character `@` would immediately terminate without doing anything. The `%` will turn this safety 'off', so when we now encounter an `@` the program will terminate (if the safety is still 'on', the `@` will be a no-op instead).
* `(`: Pop the top value, and push it to the scope. This is basically used to make the stack empty if we started somewhere in the middle.
* `9`: Push a `9`
* `@`: Terminate the program if the safety is 'off' (which it is at this point). After which all the values on the stack will be output implicitly. So it'll output the `9` for the average character of unicode `57`.
[Answer]
# [MATLAB](https://uk.mathworks.com/help/matlab/index.html)... and MS-DOS and Bash? 7 bytes
```
!echo P
```
Outputs `P`. [Length verification](https://tio.run/##K6gsycjPM/7/v1jBViEzr6C0REOTqyS/JDEHyC8uzdXIL0rRSNZUSMsvUkgGKlAo1uQqKMrMK9FIzijSANEGeqYK2gpgLfo5qXkaxZpA8P@/YmpyRr5CAAA)
---
*First post here.*
I thought this was going to be easy with MATLAB, as you can just enter a single digit number and it will return that as-is. Except that MATLAB prints more than just the number back out...
```
>> 0
ans =
     0
```
Same goes for strings.
```
>> 'a'
ans =
    'a'
```
Now I might've just waved my hands and said good enough, but where's the fun in that? :)
The only methods I knew of, that can print something to console without the extra `ans =`  would be to use the `fprintf()` or `disp()` functions.
**12 Bytes**.
```
>> fprintf('T')
T
```
**9 Bytes**. *Note, `Disp(0)` and other single-digit variations will not work due to average length constraint.*
```
>> disp('J')
J
```
These two are valid submissions, but I kept wondering... *Can I do better?*
Then I learned I could send commands to the operating system with the [Shell Escape Function](https://uk.mathworks.com/help/matlab/matlab_external/run-external-commands-scripts-and-programs.html). i.e. `!COMMAND`
*Except the command is sent to whatever operating system that machine is running on.* Since MATLAB is available for both Windows and Unix, whatever command I choose needs to work on both; ensuring that my code runs on all machines.
This more or less locked me to the single command; `echo`. *(Kinda anti-climactic, really)*
A few trials and error with the output character, and I converged to the final answer. **7 Bytes**.
```
>> !echo P
P 
```
---
*I really hope this isn't breaking any rules here...*
[Answer]
# [MAWP 0.1](https://esolangs.org/wiki/MAWP), 3 bytes
```
99:
```
Outputs 9. Works because `:` and `9` are neighbours in the table, so `9:` gives a value thats in between them, so adding another `9` guarantees that the average corresponds to `9`
[Answer]
# [Hexagony](https://github.com/m-ender/hexagony), 3 bytes
```
0!@
```
[Try it online!](https://tio.run/##y0itSEzPz6v8/99A0eH/fwA "Hexagony – Try It Online") or [Check the average character](https://tio.run/##K6gsycjPM/7/v1jBViEzr6C0REOTqyS/JDEHyC8uzdXIL0rRSNZUSMsvUkgGKlAo1uQqKMrMK9FIzijSANEGeqYK2gpgLfo5qXkaxZpA8P@/gaIDAA)
## Explanation
```
0     Set current memory edge to 0
 !    Output current memory edge as a number
  @   Terminate the program
```
[Answer]
# [SuperMarioLang](https://github.com/charliealejo/SuperMarioLang), 2 bytes
```
:%
```
[Try it online!](https://tio.run/##Ky4tSC3KTSzKzM9JzEv//99K9f9/AA "SuperMarioLang – Try It Online")
A simple answer in SuperMarioLang. The only command that gets executed is `:` which prints the value of the currently pointed memory position (0) as a number (initially 0). The second command `%` never gets executed as Mario (the command pointer) falls because there is no floor under him, so the program stops. The average between `:` and `%` is `0`.
Also [works in MarioLANG](https://tio.run/##y00syszPScxL///fSvX/fwA), where `%` is just interpreted as a comment.
[Answer]
# [Backhand](https://github.com/GuyJoKing/Backhand), 6 bytes
```
"o@7" 
```
[Try it online!](https://tio.run/##S0pMzs5IzEv5/18p38FcSeH/fwA "Backhand – Try It Online")
## Explanation
```
"  7   Start a quote, then the character 7
 o  "  (backwards) End a quote, output the character
  @    Stop the program + no-op.
```
[Answer]
# [Python 3](https://docs.python.org/3/), 10 bytes
```
print("N")
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v6AoM69EQ8lPSfP/fwA "Python 3 – Try It Online")
[Answer]
# [Java (JDK)](http://jdk.java.net/), 4 bytes
```
A->9
```
[Try it online!](https://tio.run/##LY0xC4MwEIV3f8WNsWD2Ii10ceskuJQO12jkbEwkuQil@NvTVByOx/se996EK1ZT/040L84zTNnLyGSkjlYxOStPdaEMhgB3JAvfAoAsD16jGqDZ/U5Ai85RD2tZZ7TlW@LLkILAyFnWfzjnCtGyJzs@noB@DOXR0ICGC6RbdT2neiftJ/AwSxdZLvmBjRVaamGjMeWxsaUf "Java (JDK) – Try It Online")
Outputs the number `9` which as a character is the average character of the code.
Defined as a `int f(Void v)`. Note that `Void` is an accepted argument type for "no input" challenges.
If an `int` isn't an acceptable output for this challenge, the following is most definitely valid, for an extra byte.
```
A->56
```
[Try it online!](https://tio.run/##LU2xCsIwFNz9ijemQrPpUhRcujkVXMThmTb11TQpyUtBpN8eY@lwHHfH3Q04Yzm070Tj5DzDkLWMTEbqaBWTs3Jf7ZTBEOCKZOG7AyDLndeoOqhXDaBe6EGLm6MW5qLK3pIxxachBYGRM83/cMwbomFPtr8/AH0fim2iBg0nSJfyfDimarWaT@BulC6ynHKDjRVaamGjMcV2sqQf "Java (JDK) – Try It Online")
Outputs `8` which is the average character.
Defined as a `char f(Void v)`. I was surprised that no casting to `char` was required, but it beats `v->';'` by one byte.
[Answer]
# Ruby, 6 bytes
```
$><<?8
```
average is 56.16
```
$ cat mean.rb
$><<?8
$ ruby mean.rb
8
$ python -c "[print(chr(int(0.5 + sum([ord(c) for c in s])/len(s)))) for s in [l.strip() for l in open('mean.rb')]]"
8
```
[Answer]
# [SQLite](https://www.sqlite.org/), 9 bytes
```
SELECT"@"
```
[Try it online!](https://tio.run/##Ky7MySxJ/f8/2NXH1TlEyUHp/38A "SQLite – Try It Online")
[Answer]
# Befunge-93, 5 3 bytes
```
.@!
```
[Try it online!](https://tio.run/##S0pNK81LT/3/X89B8f9/AA "Befunge-93 – Try It Online")
`.@` prints `0`. `!` was added so the average is `47.667`, which rounds to `48`, which is the ASCII code for `0`.
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 16 bytes
Outputs `6`, the average of the program.
```
-[>+<-----]>+++.
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fN9pO20YXBGLttLW19f7/BwA "brainfuck – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 5 bytes
```
()=>3
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@19D09bO@H9yfl5xfk6qXk5@ukaahqbmfwA "JavaScript (Node.js) – Try It Online")
[Answer]
# JavaScript (Browser), 10 bytes
```
alert('M')
```
[Try it online!](https://tio.run/##TY6xDoMgFEV3v@KlC7xo0bGJsUnj3KlrBwlStKFggPr7FEgHx/ty7n3nzXfuhVu3cN4vUdhZwgBT5Fq6QMmdYJyYk5vmQtL2aVrVACHYV1UhEius8VZLpq2qqkOg5ESghrJYQwq5JHeuaT7lcIQfwa1GsZezn3HhbkxI4Zjf9JpECCaL@ZskqG9AIAxX8HmeiT9@C7RDaMtDpqVRYWmgQ8Q@/gA "JavaScript (V8) – Try It Online")
[Answer]
# [AlphaBeta](https://github.com/TryItOnline/alphabeta), 10 bytes
```
edaaaaaCLz
```
[Try it online!](https://tio.run/##S8wpyEhMSi1J/P8/NSURBJx9qv7/BwA "AlphaBeta – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 1 [byte](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
0
```
Or any other single digit.
[Try it online.](https://tio.run/##yy9OTMpM/f/f4P9/AA)
[Answer]
# [Z80Golf](https://github.com/lynn/z80golf), 4 bytes
```
00000000: 3e 91 ff 76   
```
[Try it online!](https://tio.run/##q7IwSM/PSfv/3wAKrBSMUxUsDRXS0hTMzRQUFP7/BwA "Z80Golf – Try It Online")
This is `ld a, 0x91` → `rst 0x38` (putchar) → `halt`.
It prints a single `0x91` byte, and `(0x3e + 0x91 + 0xff + 0x76) / 4 = 0x91`.
]