@anonymous/

UnhappyJumpySenegalpython

Python 2.7

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6157894350656956","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IyBUaGlzIGlzIHNvbWUgYnVsbHNoaXQgY29kZSBOaWNrZmxhbWUyMCB3cm90ZS4gRG8gd2hhdGV2ZXIgeW91IHdhbnQgd2l0aCBpdC4NCklweCA9IFsiaSIsICIhIiwgIiwiLCAiLiIsICJ8IiwgIjsiLCAiOiJdDQpJSXB4ID0gWyJsIiwgIiciLCAiYCJdDQpJSUlweCA9IFsidCIsIkkiLCAiWyIsICJdIiwgXQ0KSVZweCA9IFsiZiIsImsiLCAnIicsICIoIiwgIikiLCAiKiIsICI8IiwgIj4iLCAieyIsICJ9Il0NClZweCA9IFsiYSIsICJiIiwgImMiLCAiZCIsICJlIiwgICJnIiwgImgiLCAiaiIsICJtIiwgIm4iLCAibyIsICJwIiwgInEiLCAiciIsICJzIiwgInUiLCAidiIsICJ3IiwgIngiLCAieSIsICJ6IiwgIkEiLCAiQiIsICJDIiwgIkQiLCAiRSIsICJGIiwgIkciLCAiSCIsICJKIiwgIksiLCAiTCIsICJNIiwgIk4iLCAiTyIsICJQIiwgIlEiLCAiUiIsICJTIiwgIlQiLCAiVSIsICJWIiwgIlciLCAiWCIsICJZIiwgIloiLCAiMSIsICIyIiwgIjMiLCAiNCIsICI1IiwgIjYiLCAiNyIsICI4IiwgIjkiLCAiIyIsICIkIiwgIiUiLCAiJiIsICIrIiwgIi0iLCAiLyIsICI/IiwgIlxcIiwgIl4iLCAiXyJdDQpWSXB4ID0gWyJAIiwgIn4iXQ0KDQpkZWYgdG9QeChjaGFyKToNCiAgICAgICAgaWYgY2hhciBpbiBJcHg6DQogICAgICAgICAgICAgICAgcmV0dXJuKDEpDQogICAgICAgIGVsaWYgY2hhciBpbiBJSXB4Og0KICAgICAgICAgICAgICAgIHJldHVybigyKQ0KICA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dChzcGFjZXMpKSkNCiAgICAgICAgb3V0ID0gIiINCiAgICAgICAgd2hpbGUgc3BhY2VzID4gMDoNCiAgICAgICAgICAgICAgICBvdXQgPSBvdXQgKyAiICINCiAgICAgICAgICAgICAgICBzcGFjZXMgPSBzcGFjZXMgLSAxDQogICAgICAgIHByaW50KG91dCkNCiAgICAgICAgcHJpbnQob3V0ICsgc3RyaW5nKQ0K"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# This is some bullshit code Nickflame20 wrote. Do whatever you want with it.
Ipx = ["i", "!", ",", ".", "|", ";", ":"]
IIpx = ["l", "'", "`"]
IIIpx = ["t","I", "[", "]", ]
IVpx = ["f","k", '"', "(", ")", "*", "<", ">", "{", "}"]
Vpx = ["a", "b", "c", "d", "e",  "g", "h", "j", "m", "n", "o", "p", "q", "r", "s", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "#", "$", "%", "&", "+", "-", "/", "?", "\\", "^", "_"]
VIpx = ["@", "~"]

def toPx(char):
        if char in Ipx:
                return(1)
        elif char in IIpx:
                return(2)
        elif char in IIIpx:
                return(3)
        elif char in IVpx:
                return(4)
        elif char in Vpx:
                return(5)
        elif char in VIpx:
                return(6)
        else:
                return(5)
print("""This is Nickflame20's tool for centering text in books. Input a line of text and hit enter. The first line is the number of spaces to pad the text with, the second line is a string of the spaces, and the third line is your string padded with the proper spaces.

This tool is not always perfect and may require sleight editing by a human.
""")
while True:
        pixels = -1
        string = str(input("String: "))
        
        for i in string:
                pixels = pixels + toPx(i) + 1
        spaces = ((116 - pixels) / 2) / 5
        print(round(float(spaces)))
        out = ""
        while spaces > 0:
                out = out + " "
                spaces = spaces - 1
        print(out)
        print(out + string)