Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » The shortest FizzBuzz YOU can make!
- PkmnQ
-
1000+ posts
The shortest FizzBuzz YOU can make!
That one was in a golfing language, where everything is supposed to be short.You can shave off one byte by removing the space before the or. Also, Pyth. bump
Python 3.9.5, 65 chars, and 65 bytes??for a in range(100):print('Fizz'*(a%3//2)+'Buzz'*(a%5//4) or a+1)
breakdown:for a in range(1, 100): #numbers from 1 to 100
print() #duh
'Fizz'*(a%3//2) #weird hack that adds one "Fizz" if a is divisible by three
+'Buzz'*(a%5//4) #ditto
or a+1 #my new favourite trick. if the rest of the string is empty (which happens when the number is not divisible by 3 or 5), the string is interpreted as False, which causes the string to be equal to a+1, because a+1 is True (I think)
demo of that last trick:>>> a = 5 >>> 'abc'*(int(a==5))or'xyz' 'abc' >>> a += 1 >>> 'abc'*(int(a==5))or'xyz' 'xyz'
Pyth, 34 chars/bytesIt's basically the same as the Python solution, but in Pyth. Of course, it isn't very interesting, so I'm actually working on a more interesting one in a different programming language.V100|+*"Fizz"/%N3 2*"Buzz"/%N5 4hN
this is still the shortest :o
SEVERE GLITCH ALERT!
There's a bug called the question mark glitch. Basically, sometimes, some of your costumes turn into question marks in boxes. If you're looking for the glitch in one of your projects, do NOT press see inside. If it happens that the question marks are there, they will become permanent. Go here for more information. If you spot it while editing, close the tab without saving.
Here, have a useful link:

Why it's bad to run arbitrary javascript
Also, this is where I keep my pet kumquat. I put it here because after 59.907 seconds of research I have found out that kumquats aren't cannibals.

- ScratchCatHELLO
-
1000+ posts
The shortest FizzBuzz YOU can make!
I tested it at https://lua.org/demo.html and it didn't work. didn't know you could do that in python. I thought python's syntax was supposed to make your code look clearer, why would they let you do that?save 5 bytes by removing other unnecessary spaces (at least i’m pretty sure those are unnecessary, assuming syntax is like python’s)for i=1,100do print(i%15==0and"FizzBuzz"or (i%3==0and"Fizz"or(i%5==0and"Buzz"or i)))end
oh, looks like they will eventually remove that feature anyways [/offtopic]
I didn’t test it (I don’t have access to a computer right now) and for some reason I thought putting a number next to a keyword would work (because symbols next to numbers work)
where did they say they would remove it

enter command
West of House
This is an open field west of a white house, with a boarded front door.
There is a small mailbox here.
A rubber mat saying 'Welcome to Zork!' lies by the door.
>examine mailbox
I see nothing special about the mailbox.
>
Python 3 Text Adventure
cool new browser game - cursed laughing-crying emoji - Illuminati - you know waterbenders, but do you know stock-imagebenders? - snek - vibin' - Bump song (vevo) - Speed bump - yee - fred - m i c k e y

ScratchCatHELLO
I have 4300+ posts, I've been on scratch for 3 years, I'm a Forum Helper™ and I have a Scratch Wiki account!
I like: Python, CSS, Javascript, Rust
- gosoccerboy5
-
1000+ posts
The shortest FizzBuzz YOU can make!
in the link I provided: "If [sic]* future releases it will be changed to syntax warning, and finally to a syntax error." where did they say they would remove it
*I think they mean “In”
Kerbal Space Program!!!




- ScratchCatHELLO
-
1000+ posts
The shortest FizzBuzz YOU can make!
in the link I provided: "If [sic]* future releases it will be changed to syntax warning, and finally to a syntax error." where did they say they would remove it
*I think they mean “In”
what’s “it”?

enter command
West of House
This is an open field west of a white house, with a boarded front door.
There is a small mailbox here.
A rubber mat saying 'Welcome to Zork!' lies by the door.
>examine mailbox
I see nothing special about the mailbox.
>
Python 3 Text Adventure
cool new browser game - cursed laughing-crying emoji - Illuminati - you know waterbenders, but do you know stock-imagebenders? - snek - vibin' - Bump song (vevo) - Speed bump - yee - fred - m i c k e y

ScratchCatHELLO
I have 4300+ posts, I've been on scratch for 3 years, I'm a Forum Helper™ and I have a Scratch Wiki account!
I like: Python, CSS, Javascript, Rust
- gosoccerboy5
-
1000+ posts
The shortest FizzBuzz YOU can make!
full quote:what’s “it”?in the link I provided: "If [sic]* future releases it will be changed to syntax warning, and finally to a syntax error." where did they say they would remove it
*I think they mean “In”
Deprecation warning is now emitted when compiling previously valid syntax if the numeric literal is immediately followed by a keyword (like in 0in x). If future releases it will be changed to syntax warning, and finally to a syntax error. To get rid of the warning and make the code compatible with future releases just add a space between the numeric literal and the following keyword.
Kerbal Space Program!!!




- ScratchCatHELLO
-
1000+ posts
The shortest FizzBuzz YOU can make!
full quote:what’s “it”?in the link I provided: "If [sic]* future releases it will be changed to syntax warning, and finally to a syntax error." where did they say they would remove it
*I think they mean “In”Deprecation warning is now emitted when compiling previously valid syntax if the numeric literal is immediately followed by a keyword (like in 0in x). If future releases it will be changed to syntax warning, and finally to a syntax error. To get rid of the warning and make the code compatible with future releases just add a space between the numeric literal and the following keyword.
what why
my disappointment is immeasurable and my day is ruined

enter command
West of House
This is an open field west of a white house, with a boarded front door.
There is a small mailbox here.
A rubber mat saying 'Welcome to Zork!' lies by the door.
>examine mailbox
I see nothing special about the mailbox.
>
Python 3 Text Adventure
cool new browser game - cursed laughing-crying emoji - Illuminati - you know waterbenders, but do you know stock-imagebenders? - snek - vibin' - Bump song (vevo) - Speed bump - yee - fred - m i c k e y

ScratchCatHELLO
I have 4300+ posts, I've been on scratch for 3 years, I'm a Forum Helper™ and I have a Scratch Wiki account!
I like: Python, CSS, Javascript, Rust
- SonicFanX123_321
-
500+ posts
The shortest FizzBuzz YOU can make!
0
1
2
Fizz
4
Buzz
Fizz
7
8
9
Buzz
11
Fizz
13
14
FizzBuzz
1
2
Fizz
4
Buzz
Fizz
7
8
9
Buzz
11
Fizz
13
14
FizzBuzz
(100+ SUPPORTERS) Love/Fav generator FREE
oooooooooooo ooooo ooo oooooooooo. .o. oooooooooo. ooooo ooooooooooooo
`888' `8 `888b. `8' `888' `Y8b .888. `888' `Y8b `888' 8' 888 `8
888 8 `88b. 8 888 888 .8"888. 888 888 888 888
888oooo8 8 `88b. 8 888 888 .8' `888. 888oooo888' 888 888
888 " 8 `88b.8 888 888 .88ooo8888. 888 `88b 888 888
888 o 8 `888 888 d88' .8' `888. 888 .88P 888 888
o888ooooood8 o8o `8 o888bood8P' o88o o8888o o888bood8P' o888o o888o
- Raihan142857
-
1000+ posts
The shortest FizzBuzz YOU can make!
I golfed my NASM fizzbuzz a bit more, here it is (427 characters)
%define m mov %macro x 2 m rax,rbx xor rdx,rdx m r9,%1 div r9 test rdx,rdx jz %2 %endmacro %macro y 2 %1:m rsi,%2 m rdi,i jmp e %endmacro global main section.text extern printf main:m rbx,1 m r12,100 a:x 15,b x 3,c x 5,d m rsi,rbx m rdi,j jmp e y b,h y c,f y d,g e:sub rsp,8 call printf add rsp,8 inc rbx dec r12 jnz a m rbx,0 m rax,1 int 0x80 section.data f:db"Fizz",0 g:db"Buzz",0 h:db"FizzBuzz",0 i:db"%s",10,0 j:db"%d",10,0
I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?





















- TheSecondGilbert
-
51 posts
The shortest FizzBuzz YOU can make!
here's 05AB1E
not particularly golfed.
тGNDD´3Öi"Fizz"ˆ}5Öi"Buzz"ˆ}¯JDõQiˆ},}
Hi! This is an alt of my main account.
I'm “back” from a 10-month hiatus.
I forgot the ways of the forums, so I might be wrong.
My first post!
- hello_smile
-
1000+ posts
The shortest FizzBuzz YOU can make!
Windows:
Bourne-Again Shell:
# a.bat
type a.bat
# a.sh
cat a.sh
Last edited by hello_smile (Aug. 16, 2021 06:14:34)

Achievement: Rickrolled ogadaki.
set [alternate account] to [hello-smile]
hello-smile Signature logo shop
v86
The key to 1000 messages is following hundreds of forum topics.
I am tired of everyone hating on me!
Windows 11 Release
- TheSecondGilbert
-
51 posts
The shortest FizzBuzz YOU can make!
Windows:Bourne-Again Shell:# a.bat
type a.bat# a.sh
cat a.sh
that is not fizzbuzz
Hi! This is an alt of my main account.
I'm “back” from a 10-month hiatus.
I forgot the ways of the forums, so I might be wrong.
My first post!
- hello_smile
-
1000+ posts
The shortest FizzBuzz YOU can make!
What is?Windows:Bourne-Again Shell:# a.bat
type a.bat# a.sh
cat a.sh
that is not fizzbuzz

Achievement: Rickrolled ogadaki.
set [alternate account] to [hello-smile]
hello-smile Signature logo shop
v86
The key to 1000 messages is following hundreds of forum topics.
I am tired of everyone hating on me!
Windows 11 Release
- TheSecondGilbert
-
51 posts
The shortest FizzBuzz YOU can make!
https://en.wikipedia.org/wiki/Fizz_buzzWhat is?Windows:Bourne-Again Shell:# a.bat
type a.bat# a.sh
cat a.sh
that is not fizzbuzz
Last edited by TheSecondGilbert (Aug. 16, 2021 07:16:45)
Hi! This is an alt of my main account.
I'm “back” from a 10-month hiatus.
I forgot the ways of the forums, so I might be wrong.
My first post!
- TheSecondGilbert
-
51 posts
The shortest FizzBuzz YOU can make!
Another one, this time:
APL (Dyalog Classic), 62 bytes
Try it online!
Not the best, but whatever.
Explanation later?
APL (Dyalog Classic), 62 bytes
{⎕←↑⍵[((⍴↑⍵[1])=0)+1]}¨{↑(,/((3 5|¨⍵)=0)/'Fizz' 'Buzz')⍵}¨⍳100
Not the best, but whatever.
Explanation later?
Hi! This is an alt of my main account.
I'm “back” from a 10-month hiatus.
I forgot the ways of the forums, so I might be wrong.
My first post!
- NanoRook
-
1000+ posts
The shortest FizzBuzz YOU can make!
Every post here is inherently flawed. None of these code snippets would ever fit into a professional production environment. I invite you all to browse FizzBuzz Enterprise Edition and improve your code forthwith.
Nobody cares about your post count.
- gosoccerboy5
-
1000+ posts
The shortest FizzBuzz YOU can make!
FizzBuzz Enterprise Edition and improve your code forthwith.quality. i love it Every post here is inherently flawed. None of these code snippets would ever fit into a professional production environment. I invite you all to browse
Kerbal Space Program!!!




- Discussion Forums
- » Advanced Topics
-
» The shortest FizzBuzz YOU can make!