Share your repls and programming experiences

← Back to all posts
Python 'Skittles' One-liner
MaxwellGarner (62)

Skittles One-Liner

Oh my god we hit the Popular page, I honestly don't know how or why, I only posted this so my friends could see it lmao. Full functionality -- fork the program and change the first few variables in the very first line's 'line' iykwim


Something stupid my friends made, printing "taste the rainbow" in color. I added some functionality and compressed it to one line. (It does not loop forever anymore, but it does loop quite long enough.) My friends and I will be messing around with it, so what you see might not be the actual product, so fork it and play with it yourself!

There's some config variables at the very front so if you wanna fork it and play around, have fun!


My first one-liner -- Python control statements using indentation instead of braces made it hard, but it's done! Tell me how I should improve it!
Edit: I made another one-liner check it out 0w0

Edit: Added code explanation below main function. Glad you all like it!

Another edit: All of the people I showed in-person were confused how the fading works, so I added an explanation below the other explanations. Also, ASCII art is love, ASCII art is life

Comments
hotnewtop
WILLIAMBAEWER (113)

it tastes like chicken

MaxwellGarner (62)

@WILLIAMBAEWER Chicken flavored skittles sounds concerning

AIDANGREEN6 (22)

Ahem... My homework.... (It's supposed to be a dinosaur.... You can see how skilled I am by just looking at it.)

       ____
       |    0  |___
       |         ___|
       |         |
       |         |__
       |           __)
       |          |
mrslep (30)

@AIDANGREEN6 how did you make the dinosaur in its own line
not like this
not like this

AIDANGREEN6 (22)

@srsly I actually didn't realize he was in his own line- Now it looks stupid with his feet below.

AIDANGREEN6 (22)

@srsly I didn't do anything fancy- put 6 spaces before each section to move it to the side maybe?

  ___
  | 0 0|
  |    u |

Did that do it? If not, I have no clue.
Unless highlighting and pressing tab...


| 0 0|
| w |
| |
|
| |_|

AIDANGREEN6 (22)

@srsly ok, so it was the 6 spaces before each line.

MaxwellGarner (62)

@AIDANGREEN6 If you are talking about code notation, I don't know about the 6 spaces in front of each line, but just use three backticks and a newline:

\```
multiline code
same multiline code
\```

Just without the \s (I needed them or markdown would register it)

AIDANGREEN6 (22)

@MaxwellGarner That's useful to know for the future, but I actually wasn't trying to put it in a code notation section, it just appeared there. It was actually kind of annoying, because the bottom half was missaranged with the top half, so I had to edit it to cut off everything below his arm.

MaxwellGarner (62)

@AIDANGREEN6 Oh yeah ok :) he's a great dino btw, going in the Spotlight section

AIDANGREEN6 (22)

@MaxwellGarner Thx. (however, looking in the spotlight section, I think he got disrupted through the copy and paste section- He looks kind of weird in the spotlight. (4 eyes, a u, a w,... How does he get THAT messed up?))

MaxwellGarner (62)

@AIDANGREEN6 Lmao idk, try putting him all into a big code block (markdown compresses extra spaces, except in code blocks)

AIDANGREEN6 (22)

@MaxwellGarner Oh, that explains it! The stupid markdown...

RylanPetroelje (2)

Didn't cure my cancer :-(

MaxwellGarner (62)

@Whippingdot Yes of course, the mystery drug solves all taste it

Whippingdot (652)

NO I WON'T even tho i have the symptoms of a healthy person @MaxwellGarner

MaxwellGarner (62)

@Whippingdot Did you say you were... healthy ugh you sound like you need to taste the rainbow, this one right here, taste it taste it taste it t̵a̴s̴t̴e̴ ̶i̶t̴ t̶̹̑̐a̶̖̣͔̽͌́ś̸̰̜͊t̷̖̯̔̅͠e̵̮̩͌̾̚͜ ̴͔̹̽̀͠i̵͈̭͝t̵̙̫͎̑͑̋

Whippingdot (652)

no i WON'T AAAAAAAAAAAAAAAAAAA @MaxwellGarner

MaxwellGarner (62)

@Whippingdot it definitely gives you free high-speed wifi wherever you go

Whippingdot (652)

i already have high-speed wifi @MaxwellGarner

Whippingdot (652)


I DON'T WANT TO RANDOM STRANGER ON THE ROAD!!!

MaxwellGarner (62)

@Whippingdot You better taste that rainbow, or else ( ͡ʘ ͜ʖ ͡ʘ)

Whippingdot (652)

NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO @MaxwellGarner

MaxwellGarner (62)

@Whippingdot According to @WILLIAMBAEWER it tastes like chicken, if that makes it easier

Either way TASTE IT
one of us, one of us, one of us...

Whippingdot (652)

i didn't try it HOOOOORAY

sneaks away quietly without you noticing @MaxwellGarner
MaxwellGarner (62)

@Whippingdot oh no you DONT get back here and taste the rainbow

Whippingdot (652)

no no no i won't listen to you. @MaxwellGarner

'how you look rn':

angrydoge (481)

@Whippingdot
One of us, one of us, one of us...

Whippingdot (652)

I do not understand the meme sry unless it is amog us @angrydoge

Whippingdot (652)

ok. Also u were inactive for a while right? @angrydoge

angrydoge (481)

Yeah, I scrolled from time to time, but I haven't made any projects beside the one I made yesterday. @Whippingdot

angrydoge (481)

Ơ̶̡̳̯̱̱̼̥̗̙͔̙͕̠͎̞̥̲̲͔͚̽́̀̓̎̐͗̔̆͝n̷̡̡̨̧̡̯͇̟͉̫̗͚̠̳̠̼͈̫͈͚̝̻̩̮͍̱̲͖̬̳̤̞̣̝̜̹̂͗̊͐̆̄̉́͆͗͑͊̾̂̾͐͋̍̑̈́̓̓͋̈́̀͆̂̕̚͜͝͝e̴̛̛͔̱̪̦̞̗͎̯̙̘̺̙͔̙͚̱͔̠̻̐͆̽͆͒̉͋̐̐̅̈́̚͜͜͠ ̷̲̭̳̺͚́̽̾̿͊̿̔̾͐̂̅̅͐̈́̍̈́̊̿̏̄̈́̒́̾̈͊̔͂͘͘ō̵̢͓̮̳̜͕͔̰̩͚̻͚͖͚͖̮̥͉͙̟̋̀̇̄̊̀f̶̨̻̪̩̻̰͖̼͗̊̿͑͛̍̉́̏̊͑͛̽̐͛͐͋̀̏̌̓͐̌͒̿͊̐͛̐̈̓͘͘̚̕͝ ̶̨̧̨͚̹̞̰͚͇̖̲̱̯͕͓̲̺̹̮̘̬̰̉͆̅̒̐̈́̇̂̕̕͜͜͜ư̶̧̨̛̼̰͙͚̹̳̬̻̖̞͆̏͋̾̓͊̏̉̄̀͊́́͆̉̾̄̄̂͆̈́́̚͝s̸̢̡͍̙̰͉̱͇͍̘̪̯̱̰͓̳͈͉͖͓̦̮̒̆̐̚,̶̢̧̛̖͎͇̻̹̖͖̲̓̏̎̈́̐̓͑͑͂̏̈͒̄͛́̇́̂̀͊͘͘̕̕͜͠͠ ̷̡̧̧̧̖͙̤̦̘̥͇̤̟̱͓̪̼͚̹̯͍͙̅̈̆̈̓̅̓͊̆͛̑͊̕̚̚͜͠ͅͅͅO̵̡̨̢̩̹̙̱̩͚͉̦̼̝̙͎̩͉͉͉̗̬̩̤̹͙̞̼̫̩͈̼̪̯̩͖̟̒̓̐̈́͂̈́̓̉͐́̈͘͜ͅņ̷̤̟͈̥̼͙͕̝͇̰̲̭͇̘͚͙̝͙̠͍̣͎̞̰̞̭̟̋̀͗͐́͂͆̎͌͌̈́̉͆̒̔́̂̀̎̓́͊̔̎̀̅̊̑̆̔̚͘͘̚͜ͅę̵̨͍͓͙̼̖̦̯͉̩͍̖̝̮̣̦̦̻̪͖͛́̉̏́̓̈̏͘͜͝ͅ ̶̨̡̡̡̯̘͔̜̗̦̹͇̼͍͍͖͎͕͙̗̳͚̻̺̮̰̈́̑͝ͅo̶͔̞̹̪̙̠̳̹̞̜̮̺̥͍͓̰͖̖͈͙̜͍̮͇͇͕͋̈̔̃͐͛̇̾͛́̽̀̾͜͜͜͜ͅf̵̧̢̡̨̖̪͚͕̺̭̠̯̱̩̲̻̺̣͚͚̗͍̼̗̻͗̑͐͆̐̚͘͠ ̵͚̘̠͇̗̐͆̅̄̀̆́̈̍͛̆́̌̽ǘ̶̞̼̦̩̻͚̱̋͆̍̆̈̍͆̇ş̴̨͔̼͙̘̥͇̣̟̣̯̪̭͙̆͝.̷̨̢̨̥͉̻̩̭͕̮̐͐͌͐̑̾̒͑̓͛̉̏͂̌͜͜͝͠͠.̷̧̢̧̪̱͈̟̩̯̹̥̣̣̠͔͚̤̣̺̺̰̉̿̆͂̈́̔͑̅̽͗̏̿͋̓̑̑͊̅̒͑̆̑̐͗̃͆͘̚͘͜͝.̵̡̬̘̱͕̥̫̘̹̾̓̾̇̌̌̽̕̕͝ @Whippingdot

mrslep (30)

@MaxwellGarner dont know how this got on the popular but super cool

YeeTEDWIN (8)

Nice repl you got there. Very smooth for a python colour changing word! Nice job. Btw I just made a post of my game called survivor based off of a Commodore 64. Post Link: https://replit.com/talk/share/SURVIVOR/129509

Whippingdot (652)

hey, don't advertise your post - you could get banned @YeeTEDWIN

YeeTEDWIN (8)

Oh I didn't know sorry. Thanks for telling me
@Whippingdot

1andonlyaether (19)

You want ACII art?
I'll give you ACII art. attempt #3

#####(###########(/(#################################((##########
.###.#/,///((####(///////////////(############%%.//(/#(/(##//(###
###((##(**//
(############((/%%%(/###%#####%%%/(*(#((//,####
%((#####//(###########%#.#% ,. (# ##%%#(%//(/(((/((&###(
##**(#((# ,, #####,. . , / @ .. .( /...#%%%&###
####/###( ((&## ,..%%. %. %%/ %&. ( .%#... ##%%####
.###%
#(&.. . ( &( % ,@. , %/ @. . .,%##%##%/
#####,#%/
&% . # # #. &@&%&%@@&&&%%(/#%%%&##%&&&&&#%%####%
.###(,((%&/.....%#%&%%#%########&%##/%///#%%%%##/((%%#############
##&(%%/#####%%#(/(/(///#&%%%(((///(#
/*//%%%%######%%%##########/
(##%(%#(######%%%&&&&%%%%%&%%%%%&&%&%%%%&%%%%%&&&&&%%%%%#########
.#########%###################################################%###

SilvermoonCat (436)

Traceback (most recent call last):
File "main.py", line 4, in <module>
a=[0.5,1000000,False];' --- NOTICE: CONFIG --- | First element: rainbow length (0-256) | Second element: delay between steps (>0) | Third element: One line or many (bool)';import time;t="\033c" if a[2] else '';a[0]=0 if a[0]<1 else int(a[0]);a[0]=256 if a[0]>256 else a[0];a[1]=1 if a[1]<=0 else a[1];t+="\033[38;2;{};{};{}mTaste the rainbow.";j=range(0,256,256//a[0]);k=1/a[1];p=lambda a:print([t.format(a[0],a[1],a[2]),time.sleep(k)]);f1=lambda:print(['',[p((255-i,i,0)) for i in j]],sep='',end='',flush=True);f2=lambda:print(['',[p((0,255-i,i)) for i in j]],sep='',end='',flush=True);f3=lambda:print(['',[p((i,0,255-i)) for i in j]],sep='',end='',flush=True);run=lambda:print(['',[(f1(),f2(),f3()) for _ in range(100_000_000)], run()],sep='',end='',flush=True);run()
ZeroDivisionError: integer division or modulo by zero

MaxwellGarner (62)

@SilvermoonCat No yeah sorry I was testing what happens if a float is put into the array. Fixed now

angrydoge (481)
(⌐■_■)
( •_•)>⌐■-■
(•_•)
markverb1 (1)

T A S T E T H E R A I N B O W

Dedf1sh08 (1)

Rainbow sounds really delicious

Tacostorm2 (8)

But, how can I taste the rainbow if the rainbow, in it of it self, is a rainbow? Sorry... I speak weird after tasting that rainbow chicken pill thing. Oh yeah... I also grew 5 extra eyes.

CookieSnowOwl (41)

lol i slowed it down and like every some moment there's a "easter egg lol"

MaxwellGarner (62)

@MatthewHou You're the only one to have seen that lmao

CookieSnowOwl (41)

can you do like a while True?

MaxwellGarner (62)

@MatthewHou Unfortunately not -- Python does not allow multiple control statements per line. That is why every if is in an assignment (being used like ? : from C), every for is after an array (usage called 'list comprehension') and I use a for loop for run. for _ in itertools.count() functions the same as while True, though, I found out!

MarcusWeinberger (786)

now do it without semicolons >;)

Whippingdot (652)

nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo to hard @MarcusWeinberger

SudhanshuMishra (247)

wow tHIS iSis som uch coo l

rafrafraf (1390)

this is amazing dude! if u wanna try to challenge urself more try do it with no semi colons

AIDANGREEN6 (22)

My homework, as mentioned in the code:


| 0 |
|
|
| |

1andonlyaether (19)

You want ACII art?
I'll give you ACII art. attempt #2

      ...,/(((/*,.                        ...,,...                  ..,,,,...,,*/ 

,######(/(########%####/,(###################%######################(#############.
(###
##//**///(####(//////////*////(((/####/########&%%/(((/(#((((%#///(%##,
%#####%%%(/
(, /#################%/(/%(///(###(#######%%%//.(((/. /////(/#####,
.##(*/(%/,/(###&#############/(%#((///(#,. /(# ####%%%((#%#%#(/(((%/(///####.
.##%(((#%%#%(//((((####(
.#####%%%%%& ,/ ../ ##& #(((/ . (((########
##(
,/#%((/. ,,. .###/.... . ( # %. .#. . # [email protected]#%%%%&####
###%#((#(% //##%%%
,. .#%,. %. %#@ ,%&. #. &.... (%#%%######,
###%%%%#% ,# %%/. %( %%&. . /. .&. ,# , %( #%#######%
.####.,(##%%&&&&%. , , (& (@, &@#... ,. %%&. /&&@ ....%&/#%####/
%####,/(%@. .,.. &. ,#, ./%&@&%&@&&&%&&%####(//(/((##%###%#%%%%%######%#####
####%,//%&@.,....(##%&&%%#%%##########&%%(((%////#%%%%%%#%/((#%%################.
(###%/(%#(##%%&&&&&#/,//////((///#%&,,(#(////((,,,/(%&&&#((((&&(/((#(///(/(#####
###%
,/ ####%%##%%%%%%&####%%(((###(#%%%%%###**
//##((#(##(/(#(%(#%(%(##*/#####(
###%(&&%/######%%%##%#%%########%%%%%%%%%%%%%%%%%%%%%%%%######%%%%%%%%%###########/
.###########%%%#%%%%#######################################################%%%%%###

1andonlyaether (19)

You want ACII art?
I'll give you ACII art.

      ...,/(((/*,.                        ...,,...                  ..,,,,...,,*/ 

,######(/(########%####/,(###################%######################(#############.
(###
##//**///(####(//////////*////(((/####/########&%%/(((/(#((((%#///(%##,
%#####%%%(/
(, /#################%/(/%(///(###(#######%%%//.(((/. /////(/#####,
.##(*/(%/,/(###&#############/(%#((///(#,. /(# ####%%%((#%#%#(/(((%/(///####.
.##%(((#%%#%(//((((####(
.#####%%%%%& ,/ ../ ##& #(((/ . (((########
##(
,/#%((/. ,,. .###/.... . ( # %. .#. . # [email protected]#%%%%&####
###%#((#(% //##%%%
,. .#%,. %. %#@ ,%&. #. &.... (%#%%######,
###%%%%#% ,# %%/. %( %%&. . /. .&. ,# , %( #%#######%
.####.,(##%%&&&&%. , , (& (@, &@#... ,. %%&. /&&@ ....%&/#%####/
%####,/(%@. .,.. &. ,#, ./%&@&%&@&&&%&&%####(//(/((##%###%#%%%%%######%#####
####%,//%&@.,....(##%&&%%#%%##########&%%(((%////#%%%%%%#%/((#%%################.
(###%/(%#(##%%&&&&&#/,//////((///#%&,,(#(////((,,,/(%&&&#((((&&(/((#(///(/(#####
###%
,/ ####%%##%%%%%%&####%%(((###(#%%%%%###**
//##((#(##(/(#(%(#%(%(##*/#####(
###%(&&%/######%%%##%#%%########%%%%%%%%%%%%%%%%%%%%%%%%######%%%%%%%%%###########/
.###########%%%#%%%%#######################################################%%%%%###

                                                                                  
AIDANGREEN6 (22)

@1andonlyaether Don't sell the bike shop, orville.

1andonlyaether (19)

test to see how much ascii thingies i can get in a single comment test to see how much ascii thingies i can get in a single comment test to see how much ascii thingies i can get in a single comment

SethPeace (3)

[(f1(), f2(), f3()) for _ in itertools.count()] would loop forever... just make sure to import itertools!

cannonthepom123 (18)

|VVVV|
| 0 0|
|____|
/|----|\
( | | )
| /\ |
| | ||
W W
wow

MaxwellGarner (62)

@cannonthepom123 Lol thanks! Another ASCII art professional, I see!

RhinoRunner (866)

it went from changing colors smoothly to randomly flashing colors

MaxwellGarner (62)

@RhinoRunner Oh lol sorry. My friend and I are messing around with the code, one of the variables controls that