[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Fizz Buzz Interview Question

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 80
Thread images: 8

File: download.jpg (9KB, 225x225px) Image search: [Google]
download.jpg
9KB, 225x225px
You have _ minutes to solve the most famous programming interview question in your favourite language:

>Print the numbers 1 to 100
>Next to every multiple of 3, print Fizz
>Next to every multiple of 5, print Buzz
>Next to every multiple of 3 and 5, print Fizz Buzz
>>
>>58944490

FizzBuzz_1.java

class FizzBuzz {
public static void FizzBuzz1To50(){
System.out.println("1");
System.out.println("2");
System.out.println("Fizz");
System.out.println("4");
System.out.println("Buzz");
System.out.println("Fizz");
System.out.println("7");
System.out.println("8");
System.out.println("Fizz");
System.out.println("Buzz");
System.out.println("11");
System.out.println("Fizz");
System.out.println("13");
System.out.println("14");
System.out.println("FizzBuzz");
System.out.println("16");
System.out.println("17");
System.out.println("Fizz");
System.out.println("19");
System.out.println("Buzz");
System.out.println("Fizz");
System.out.println("22");
System.out.println("23");
System.out.println("Fizz");
System.out.println("Buzz");
System.out.println("26");
System.out.println("Fizz");
System.out.println("28");
System.out.println("29");
System.out.println("FizzBuzz");
System.out.println("31");
System.out.println("32");
System.out.println("Fizz");
System.out.println("34");
System.out.println("Buzz");
System.out.println("Fizz");
System.out.println("37");
System.out.println("38");
System.out.println("Fizz");
System.out.println("Buzz");
System.out.println("41");
System.out.println("Fizz");
System.out.println("43");
System.out.println("44");
System.out.println("FizzBuzz");
System.out.println("46");
System.out.println("47");
System.out.println("Fizz");
System.out.println("49");
System.out.println("Buzz");
}
}
>>
>>58944490
Something something %3 %5 == 0 return jizzbuzz
>>
>>58944490
nice try pajeet
>>
>>58944631

FizzBuzz_2.java

classFizzBuzz {
public static void FizzBuzz51to100(){
System.out.println("Fizz");
System.out.println("52");
System.out.println("53");
System.out.println("Fizz");
System.out.println("Buzz");
System.out.println("56");
System.out.println("Fizz");
System.out.println("58");
System.out.println("59");
System.out.println("FizzBuzz");
System.out.println("61");
System.out.println("62");
System.out.println("Fizz");
System.out.println("64");
System.out.println("Buzz");
System.out.println("Fizz");
System.out.println("67");
System.out.println("68");
System.out.println("Fizz");
System.out.println("Buzz");
System.out.println("71");
System.out.println("Fizz");
System.out.println("73");
System.out.println("74");
System.out.println("FizzBuzz");
System.out.println("76");
System.out.println("77");
System.out.println("Fizz");
System.out.println("79");
System.out.println("Buzz");
System.out.println("Fizz");
System.out.println("82");
System.out.println("83");
System.out.println("Fizz");
System.out.println("Buzz");
System.out.println("86");
System.out.println("Fizz");
System.out.println("88");
System.out.println("89");
System.out.println("FizzBuzz");
System.out.println("91");
System.out.println("92");
System.out.println("Fizz");
System.out.println("94");
System.out.println("Buzz");
System.out.println("Fizz");
System.out.println("97");
System.out.println("98");
System.out.println("Fizz");
System.out.println("Buzz");
}
}
>>
>>58944631
>>58944644

Sorry, of course all methods are in ONE class FizzBuzz.java.

public static void main(String[] args){
FizzBuzz1to50();
FizzBuzz51to100();
}
>>
>>58944490
fizzbuzz n
| divBy 15 = "Fizz Buzz"
| divBy 3 = "Fizz"
| divBy 5 = "Buzz"
| otherwise = ""
where
divBy k = n `mod` k == 0

main = mapM_ printfbz [1..100]
where
printfbz i = putStrLn (show i <> " " <> fizzbuzz i)
>>
public static void fizzbuzz(int max) {
assert max > 0;
for(int i = 1; i < (max + 1); i++) {
boolean printed = false;
if(i % 5 == 0) {
System.out.print("Fizz");
printed = true;
}
if(i % 3 == 0) {
System.out.print("Buzz");
printed = true;
}
if(!printed) {
System.out.print(i);
}
System.out.print("\n");
}
}


we java now
>>
class FizzBuzz{
public static void main(String[] args){
int i =1;
while(i < 50){
System.out.print(i);
System.out.print("");
if(i%3==0) System.out.print("Fizz");
if(i%5==0) System.out.print("Buzz");
System.out.println();
i++;
}
}
}


Did i do well g?
>>
>>58944490

If you can't do it in HolyC you fucking suck and you should kill yoruself stupid nigger cattle
>>
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>
>>58944898
A for loop would have been a little nicer, but a functional fizzbuzz for 1 to 49.
>>58944731
Fuck I didn't read the OP and see that you had to print each number
>>
>>58944936
done again in a loop.
class FizzBuzz{
public static void main(String[] args){
for(int i =1; i<50; i++){
System.out.print(i);
System.out.print(" ");
if(i%3==0){
System.out.print("Fizz");
System.out.print(" ");
}
if(i%5==0) System.out.print("Buzz");
System.out.println();
}
}
}
>>
npm install --save fizzbuzz-solver

var fizzbuzz = require('fizzbuzz-solver')

fizbuzz(0, 100);


I just started coding in node.js a couple of weeks ago and spent like 15 minutes searching for the right module with the least amount of bloat
i think it works alright
>>
I'm still trying to figure out how functions and loops work but I am excited for the day I can do fizzbuzz.
>>
>b-b-but I'm a web designer, not a math professor!

<html>
<head>
<style>
@import "compass/css3";

ul{
list-style-type:none;
}
li:nth-child(3n), li:nth-child(5n){
font-size:0px;
}

li:nth-child(3n):before{
font-size:16px;
content:"Fizz";
}
li:nth-child(5n):after{
font-size:16px;
content:"Buzz";
}

</style>
</head>

<body>
<ul>
<li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li><li>11</li><li>12</li><li>13</li><li>14</li><li>15</li><li>16</li><li>17</li><li>18</li><li>19</li><li>20</li><li>21</li><li>22</li><li>23</li><li>24</li><li>25</li><li>26</li><li>27</li><li>28</li><li>29</li><li>30</li><li>31</li><li>32</li><li>33</li><li>34</li><li>35</li><li>36</li><li>37</li><li>38</li><li>39</li><li>40</li><li>41</li><li>42</li><li>43</li><li>44</li><li>45</li><li>46</li><li>47</li><li>48</li><li>49</li><li>50</li><li>51</li><li>52</li><li>53</li><li>54</li><li>55</li><li>56</li><li>57</li><li>58</li><li>59</li><li>60</li><li>61</li><li>62</li><li>63</li><li>64</li><li>65</li><li>66</li><li>67</li><li>68</li><li>69</li><li>70</li><li>71</li><li>72</li><li>73</li><li>74</li><li>75</li><li>76</li><li>77</li><li>78</li><li>79</li><li>80</li><li>81</li><li>82</li><li>83</li><li>84</li><li>85</li><li>86</li><li>87</li><li>88</li><li>89</li><li>90</li><li>91</li><li>92</li><li>93</li><li>94</li><li>95</li><li>96</li><li>97</li><li>98</li><li>99</li><li>100</li>
</ul>
</body>
</html>

>>
>>58944994
Trying to learn vim so I did another in Python3
for i in range(100):
print(i, end = " ");
if(i%3==0):
print("Fizz", end = " ");
if(i%5==0):
print("Buzz", end = " ");
print("\n");
>>
>>58945440
u realize all ur answers are fucked?

ur supposed to print Fizz on 3
not
3Fizz
>>
>>58946254
Read the OP again.
Thanks for coming along to the interview, you'll hear back from us if you've been successful.
>>
>>58946271
if you don't know 'fizzbuzz' by heart and fall for the trap then you have no chance, idiot
>>
>>58946288
>Print the numbers 1 to 100
>Next to every multiple of 3, print Fizz
The idiot is you, and the trap is not reading the question.
>>
>>58946316
>solve the most famous programming interview question
says that
BEFORE the trap description
get rekt
>>
#include <stdio.h>

#define LEN 30

int main (void) {
unsigned i = 1;
for(;i<=LEN;i++) {
if ( !(i%3) || !(i%5) ) {
if (!(i%3)) printf ("Fizz");
if (!(i%5)) printf ("Buzz");
putchar ('\n');
} else {
printf ("%u\n", i);
}
}
return 0;
}


wonder if i can do it without the mods
>>
>>58944490
int main(void){
int i;
for(i=1; i<=100; i++){
if(i%3 == 0 && i%5 == 0) printf("Fizzbuzz\n");
else if (i%3 == 0) printf("Fizz\n");
else if (i%5 == 0) printf("Buzz\n");
else printf("%d\n", i);
}
return 0;
}
>>
#include <iostream>
using namespace std;

int main()
{
int counter=1;
while (counter<=100)
{
if (counter%3==0)
{
if (counter%5==0)
{
cout << "FizzBuzz" << endl;
++counter;
continue;
}
cout << "Fizz" << endl;
++counter;
continue;
}
if (counter%5==0)
{
cout << "Buzz" << endl;
++counter;
continue;
}
else
{
cout << counter << endl;
++counter;
}
}
return 0;
}
>>
#include <stdio.h>
#include <stdlib.h>

int main()
{

for(int i = 1; i<=100; i++){
if((i % 3 == 0)&&(i % 5 == 0)){
printf("%dFizz Buzz\n", i);

}else if (i % 3 ==0){
printf("%dFizz\n", i);

}else if (i % 5 == 0){
printf("%dBuzz\n", i);
}else{
printf("%d\n", i);
}

}

return 0;
}
>>
eval( hex2bin('20202020666f7265616368202872616e676528312c203130302920617320246c696e65293a0a0a202020202020202024627933203d20246c696e65202520333b0a202020202020202024627935203d20246c696e65202520353b0a0a202020202020202069662028212462793320262620212462793529207b7072696e74202246697a7a42757a7a223b7d200a2020202020202020656c736569662028212462793329207b7072696e74202246697a7a223b7d200a2020202020202020656c736569662028212462793529207b7072696e74202242757a7a223b7d200a2020202020202020656c7365207b7072696e7420246c696e653b7d0a20202020202020207072696e7420225c6e223b0a0a20202020656e64666f72656163683b' ) );
>>
>>58945440
>"print numbers 1 to 100"
>prints range instead, 0 to 99
F, you don't even get a phonecall back.

for i in range(100):
i = i + 1
print(i, end = " ");
if(i%3==0):
print("Fizz", end = " ");
if(i%5==0):
print("Buzz", end = " ");
print("\n");
>>
Holy kek /g/ is stupid as fuck!
Read the OP again faggots. That's why y'all are petty NEETS, can't even read. Sad.
>>
>>58944490
#include <stdio.h>
#define LEFT_BRACE {
#define RIGHT_BRACE }
#define LEFT_BRACKET [
#define RIGHT_BRACKET ]
#define LEFT_PARENTHESIS (
#define RIGHT_PARENTHESIS )
#define SEMICOLON ;
#define COMMA ,
#define EQUALS =
#define IS_EQUAL_TO ==
#define IS_NOT_EQUAL_TO !=
#define IS_LESS_THAN <
#define IS_GREATER_THAN >
#define IS_LESS_THAN_OR_EQUAL_TO <=
#define IS_GREATER_THAN_OR_EQUAL_T >=
#define MODULUS %
#define INCREMENT ++
#define DECREMENT --
#define AND &&
#define OR ||

int main LEFT_PARENTHESIS RIGHT_PARENTHESIS
LEFT_BRACE
int i SEMICOLON
for LEFT_PARENTHESIS i EQUALS 0 SEMICOLON i IS_LESS_THAN_OR_EQUAL_TO 100 SEMICOLON i INCREMENT RIGHT_PARENTHESIS
LEFT_BRACE
if LEFT_PARENTHESIS i MODULUS 3 IS_NOT_EQUAL_TO 0 AND i MODULUS 5 IS_NOT_EQUAL_TO 0 RIGHT_PARENTHESIS
printf LEFT_PARENTHESIS "%d" COMMA i RIGHT_PARENTHESIS SEMICOLON
if LEFT_PARENTHESIS i MODULUS 3 IS_EQUAL_TO 0 RIGHT_PARENTHESIS
printf LEFT_PARENTHESIS "Fizz" RIGHT_PARENTHESIS SEMICOLON
if LEFT_PARENTHESIS i MODULUS 5 IS_EQUAL_TO 0 RIGHT_PARENTHESIS
printf LEFT_PARENTHESIS "Buzz" RIGHT_PARENTHESIS SEMICOLON

printf LEFT_PARENTHESIS " " RIGHT_PARENTHESIS SEMICOLON
RIGHT_BRACE

printf LEFT_PARENTHESIS "\n" RIGHT_PARENTHESIS SEMICOLON
return 0 SEMICOLON
RIGHT_BRACE
>>
In vim:
i1<Esc>qqYp<C-a>q98@qqq0C Buzz<Esc>5kq19@q2jqq0cwFizz<Esc>3jq32@q:%s/ //
>>
File: 1325478757001.jpg (11KB, 232x251px) Image search: [Google]
1325478757001.jpg
11KB, 232x251px
public static void main(string []args){
int i;

if (i == "BUZZ")
system.out.println(buzzfizz)
if (i == "FIZZ")
system.out.println(fizzbuzz)

for(i = 0; i < 100; i++)
system.out.println((int)i)

return void
}
>>
File: d_fizzbuzz.png (57KB, 800x334px) Image search: [Google]
d_fizzbuzz.png
57KB, 800x334px
Obligatory.
>>
>>58947549
He wrote that crap?
>>
One line in bash
curl "https://s3.amazonaws.com/fizzbuzz/output"
>>
What are some other interview questions?

Also is FizzBuzz just a meme or employers actually use it as a test?

I don't understand why would you try to get a job involving programming if you can't solve this.
>>
File: when_the_D_hits_you.jpg (23KB, 512x512px) Image search: [Google]
when_the_D_hits_you.jpg
23KB, 512x512px
>>58947565
>>
>>58944490

@echo off
echo 1
echo 2
echo 3
echo Fizz
echo 4
echo 5
echo Buzz
echo 6
echo 7
echo 8
echo 9
echo Fizz
echo 10
echo 11
echo 12
echo 13
echo 14
echo 15
echo Fizz Buzz
>>
File: lookingatcode.gif (2MB, 300x225px) Image search: [Google]
lookingatcode.gif
2MB, 300x225px
>>58947594
>invert a binary tree
>where do you see yourself in 5 years
>what can you contribute to our company
>fizzbuzz, then fizzbuzz without modulo
>would you pull the lever of the trolley problem
>write a program that prints out the password to your facebook account backwards
>the user X killed himself under mysterious circumstances: what do you do with the leftover data


also: https://css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/
>>
>>58947852
i see myself working at your company :^)
>>
>>58947940
why would you like to work for our company
>>
>>58947852
> I have seen many comments here that are unnecessarily harsh or rude. Rudeness adds nothing constructive to the conversation so I’m perfectly okay with seeing rude, harsh or nonconstructive comments removed.
> There are some people writing that if you can’t “FizzBuzz” you don’t belong in this industry. That’s a harsh thing to say and it’s simply not true.

Gets me every time.
>>
>>58947852
>fizzbuzz without modulo
Why?
>>
File: trash1.jpg (7KB, 213x237px) Image search: [Google]
trash1.jpg
7KB, 213x237px
>>58947852
>>58947963
> There are some people writing that if you can’t “FizzBuzz” you don’t belong in this industry. That’s a harsh thing to say and it’s simply not true.

If you can't write a FizzBuzz you're basically mentally challenged
>>
>>58947975
Why not?
#include <stdio.h>

int main() {
size_t f = 0, b = 0, to = 20;
for (size_t i = 1; i <= to; ++i, ++f, ++b) {
int ft = (f = f > 2 ? 0 : f) == 2;
int bt = (b = b > 4 ? 0 : b) == 4;
printf("%s", ft ? "Fizz" : "");
printf("%s", bt ? "Buzz" : "");
printf(ft || bt ? "\n" : "%zu\n", i);
}
}
>>
>>58947975
to prove you didn't only memorize the first google result and/or can think up multiple ways to solve the problem
>>
>>58944490
for i in range(1,101):
fb = ''
if i % 3 == 0:
fb += 'Fizz'
if i % 5 == 0:
fb += 'Buzz'
print(fb or i)
>>
>>58948002
just check if there is a decimal. it hardly makes the problem more complicated.
>>
>>58948057
in a stressful situation like a job interview, you might freeze on the one fizzbuzz solution or you might still be able to think around the obstacle. its not about complexity
>>
>>58947632

literally the easiest FizzBuzz I've seen
>you're hired
>>
The basic bitch version

for x in range(1, 101):
if x % 3 == 0 and x % 5 == 0:
print('FizzBuzz')
elif x % 3 == 0:
print('Fizz')
elif x % 5 == 0:
print('Buzz')
else:
print(x)
>>
for (var i = 1; i <= 100; i++) {
var f = i % 3 == 0, b = i % 5 == 0;
console.log(f ? b ? "FizzBuzz" : "Fizz" : b ? "Buzz" : i);
}
>>
>>58948034
interesting way of doing it
>>
>>58948179
It makes it easy to change the fizz/buzz parameters, and it's very compact.

(I've also done this before)
>>
>>58948176
Nice job, but hard to read. I know the language, but I still had to do a double take to understand this simple code.
>>
Feel free to entertain yourselves with trivial convolutions if you wish, but it's still just the integer rings modulo 5 and 3. You're not going to find a novel way of doing it, just ways of adding entropy to the answer.
>>
>>58947852
>>would you pull the lever of the trolley problem
I would walk out of my job the first day anyone referenced a meme irl
>>
>>58944490
VBA

debug.print "1" & vbnewline & "2" & vbnewline & "fizz" & vbnewline & "4" & vbnewline & "buzz" & vbnewline & "fizz" & vbnewline & "7" & vbnewline & "8" & vbnewline & "fizz" & vbnewline & "buzz" & vbnewline & "11" & vbnewline & "fizz" & vbnewline & "13" & vbnewline & "14" & vbnewline & "fizzbuzz" & vbnewline & "16" & vbnewline & "17" & vbnewline & "fizz" & vbnewline & "19" & vbnewline & "buzz" & vbnewline & "fizz" & vbnewline & "22" & vbnewline & "23" & vbnewline & "fizz" & vbnewline & "buzz" & vbnewline & "26" & vbnewline & "fizz" & vbnewline & "28" & vbnewline & "29" & vbnewline & "fizzbuzz" & vbnewline & "31" & vbnewline & "32" & vbnewline & "fizz" & vbnewline & "34" & vbnewline & "buzz" & vbnewline & "fizz" & vbnewline & "37" & vbnewline & "38" & vbnewline & "fizz" & vbnewline & "buzz" & vbnewline & "41" & vbnewline & "fizz" & vbnewline & "43" & vbnewline & "44" & vbnewline & "fizzbuzz" & vbnewline & "46" & vbnewline & "47" & vbnewline & "fizz" & vbnewline & "49" & vbnewline & "buzz" & vbnewline & "fizz" & vbnewline & "52" & vbnewline & "53" & vbnewline & "fizz" & vbnewline & "buzz" & vbnewline & "56" & vbnewline & "fizz" & vbnewline & "58" & vbnewline & "59" & vbnewline & "fizzbuzz" & vbnewline & "61" & vbnewline & "62" & vbnewline & "fizz" & vbnewline & "64" & vbnewline & "fizz" & vbnewline & "fizz" & vbnewline & "67" & vbnewline & "68" & vbnewline & "fizz" & vbnewline & "buzz" & vbnewline & "71" & vbnewline & "fizz" & vbnewline & "73" & vbnewline & "74" & vbnewline & "fizzbuzz" & vbnewline & "76" & vbnewline & "77" & vbnewline & "fizz" & vbnewline & "79" & vbnewline & "buzz" & vbnewline & "fizz" & vbnewline & "82" & vbnewline & "83" & vbnewline & "fizz" & vbnewline & "buzz" & vbnewline & "86" & vbnewline & "fizz" & vbnewline & "88" & vbnewline & "89" & vbnewline & "fizzbuzz" & vbnewline & "91" & vbnewline & "92" & vbnewline & "fizz" & vbnewline & "94" & vbnewline & "buzz" & vbnewline & "fizz" & vbnewline & "97"

Cont.
>>
>>58947594
9 out of 10 CS majors cannot fizzbuzz
>>
>>58948232
from india? otherwise i think that's bullcrap.
>>
>>58948223
cont.
& vbnewline & "98" & vbnewline & "fizz" & vbnewline & "buzz"
>>
>>58948205
I used to feel the same way until i memorized this "new" syntax (new to me) and it helped me read and write more advanced JS
>>
>>58947997
#include <stdio.h>

#define fb(x,i,s) ((x)[i] ? (s) : "")
const int fizz[] = { 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1 };
const int buzz[] = { 0,0,0,0,1,0,0,0,0,1,0,0,0,0,1 };
const size_t to = 100;

int main() {
size_t cnt = 0;
for (size_t i = 1; i <= to; ++i, ++cnt) {
cnt = cnt >= 15 ? 0 : cnt;
printf("%s%s", fb(fizz,cnt,"Fizz"), fb(buzz,cnt,"Buzz"));
printf(!fizz[cnt] && !buzz[cnt] ? "%zu\n" : "\n", i);
}
}
>>
>>58948244
keep in mind this is on a whiteboard no stack overflow allowed
>>
def mark(lst, multiple, word):
for i in range(1, 101 // multiple + 1):
lst[i * multiple - 1] += word

res = ["{} ".format(i) for i in range(1, 101)]
mark(res, 3, "Fizz")
mark(res, 5, "Buzz")


Depends on your interpretation of "next to". I assumed it was literally next to it, and not after it on a separate line.
>>
>>58948384
Of course
print(res)
>>
for i in range (1,101):
v="";
if(i%3==0): v+="Fizz"
if(i%5==0): v+="Buzz"
print(i,"\t",v)


>Next to every multiple of 3 and 5, print Fizz Buzz

Why putting a space between Fizz and Buzz ?
>>
>>58948444
> one-line if
Read PEP please
>>
>>58944490
>>58944490
>>58944490
int i;
for(i = 1; i< 101; i++){
printf("%d ", i);
if(!(i%3)) printf("Fizz");
if(!(i%5)) printf("Buzz");
}

inside int main and #include stdio and all that jazz
>>
>>58946254
>>58946271
>>58946288
>>58946316
>>58946332
oh God, which one is right???? do I follow the potentially buggered instructions or do I follow convention???? I JUST WANT TO BE PAID FOR MY SERVICES
>Thanks for coming along to the interview, you'll hear back from us if you've been successful.
>>
>>58947949
I think the culture and stated goals on your website are a great fit for my interests and mindset
>>
for i in range(1,101):
if (i/3.0).is_integer() and (i/5.0).is_integer():
print "FizzBuzz"
elif (i/3.0).is_integer():
print "Fizz"
elif (i/5.0).is_integer():
print "Buzz"
else:
print i
>>
>>58945311
good one
>>
>>58948362
even still... by the time you graduate any cs program in the US you should have seen modulo, the idea that you wouldn't have is ridiculous beyond belief

I've literally only heard students saying this, I've never heard degree holders claiming that people can't fizzbuzz. You might find some funny anecdotes on reddit or something but beyond that the idea that people can't fizzbuzz is laughable. This is there to weed out the complete fakes and nothing else.
>>
threes = {*range(3,101,3)}
fives = {*range(5,101,5)}
all_ = {*range(1,101)}

fizzbuzz = threes & fives
fizz = threes - fizzbuzz
buzz = fives - fizzbuzz
rest = all_ - threes - fives
concat = [[i, str(i)] for i in rest] + [[i, "fizz"] for i in fizz] + [[i, "buzz"] for i in buzz] + [[i, "fizzbuzz"] for i in fizzbuzz]
concat.sort(key=lambda x: x[0])

print("\n".join((i[1] for i in concat)))
>>
If we're taking the OP problem word for word, there should be a space in between 'Fizz' and 'Buzz' for the multiples of 3 and 5, you all fail.

>Fix it faggots
>>
File: 139823724733.gif (2MB, 236x224px) Image search: [Google]
139823724733.gif
2MB, 236x224px
>>58947528
>>
newfag here how do i put the code panel in my post?
>>
>>58949488
[code ] code here [ /code]

without spaces in the tag
>>
>>58949635
thanks

 for(i in 1:100){

ifelse(!(i %% 15),print(paste(i,"Fizz Buzz")),
ifelse(!(i %% 3),print(paste(i,"Fizz")),
ifelse(!(i %% 5),print(paste(i,"Buzz")),print(i))))

}
Thread posts: 80
Thread images: 8


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.