LaVOZs

The World’s Largest Online Community for Developers

'; Newest 'fizzbuzz' Questions - LavOzs.Com

Questions tagged [fizzbuzz]

a game, algorithm and a common programming task of replacing any number divisible by three with the word "fizz", and any number divisible by five with the word "buzz"

• What is the star (*) doing in this FizzBuzz solution?

Learning programming in Python and I am doing some challenges. I've run into something I haven't learned yet and was curious what this code is doing. So my challenge is called the "FizzBuzz" ...
• How do I write the fizzbuzz function in Python 3 with an input value?

I am writing a function fizzbuzz and what I want to do is input value and return it as fizz, buzz or fizzbuzz. However, there is a problem with my code. Whenever I run this, I just only get the first ...
• how to create a divisible by method in ruby

i am currently studying ruby and your help would be much appreciated. i am trying to display the below results in my terminal: 1 2 3 i am divisible by 3 4 5 i am divisible by 5 6 i am divisible by 3 ...
• JavaScript coding problem called FizzBuzz [closed]

I am trying to figure out what I am doing wrong with this problem. I seem to be missing something that is not allowing my code to work. I need to use a function to create an array that takes one ...
• JS: Fizz Buzz Sequence Quiz (Display last element in series as Integer in case it equals to Fizz, Buzz or Fizz Buzz)

I'm creating a quiz based on the Fizz Buzz sequence where the user needs to guess the last element in the series. Example: 422, Fizz, 424, Buzz, ? Possible answers should be: Fizz Buzz Fizz ...
• fizzbuzz in assembly x86 outputs nothing

I am currently trying to make a program in assembly x86 that is compiled using nasm that outputs the numbers 1 through 20. if the number is a factor of three it outputs fizz otherwise it outputs the ...
• Fizz Buzz question with extra difficulty layer

I am trying to solve the Fizz Buzz question with an extra layer. This is what I have so far. All this works fine but I need one more extra condition. It's JS Unit testing For any other input (...
• I get a (T_CONSTANT_ENCAPSED_STRING) parse error when using fizzbuzz.php typed directly from the book I'm using

I'm trying to make the fizzbuzz.php assignment from PHP and MySQL Web Development 5th Edition, page 193. I have typed it exactly as it is in the book, but I get a (T_CONSTANT_ENCAPSED_STRING) parse ...
• Java FizzBuzz 1 Line

How can one complete the FizzBuzz exercise in Codingbat with just a return statement? The code that I last used to solve the problem was: public String[] fizzBuzz(int start, int end) { String[] a =...
• FizzBuzz solution in an arraylist

I have been given the classic FizzBuzz test to do. However, the problem has an extra task which is to display the results in an ArrayList. I know that you can't just stick an integer and string values ...
• FizzBuzz program never satisfies one of the conditions

Write a Python program that displays a message as follows for a given number: If it is a multiple of three, display "Zip" If it is a multiple of five, display "Zap". If it is a multiple of both three ...
• FizzBuzz also printing numbers that contain3 and 5

I have been trying to learn about the FizzBuzz problem using Python, I found it fairly easy so decided to add an extra layer of complexity. My Question is: How would I also get the program to also ...
• Calling solution class in main [duplicate]

I'm trying to mimic a solution to the FizzBuzz problem in Eclipse. The solution class has been given, but I'm not entirely sure on how to run it in main to print the result. In the solution, the list ...
• Read json data entries as objects in python file

I want to solve fizzbuzz problem using SOLID principles in python I wrote this code: class tester(object): def check(self, number, string): return ", ".join(self.check_numbers(number, ...
• I am trying to better understand recursion by using the FizzBuzz problem in javascript

I don't understand line 18? If the input is 100 how does program print out the number 1 first and end with the number 100 in the array? Any help would be appreciated. function fizzBuzz(n){ //...
• FizzBuzz Test Assignment C# TDD [closed]

Recently I did a FizzBuzz Test Assignment using C# and TDD but I was told that I didn't meet their exceptions on this exercise to get a second stage interview. Can someone please let me know why I ...
• What is the difference between return and console.log()

I get different outputs when I use console.log() in my function vs when I use the return statement. When I run the function with the return statement I get a one word output which is one of the ...
• C++ Fizz Buzz alternative version

I'm relatively new to stack overflow (yes, i'm extremely new to coding), and i'm currently working on an altered version of the Fizz Buzz Question. Could someone help me figure out as to what i'm ...
• Finding multiples using recursion

Given 1 to 100 numbers, for multiples of 3 it should print "he" ,for multiples of 5 it should print "llo" ,for both multiples of 3 and 5 it should print "hello". This is what I have: for i in range ...
• FizzBuzz: 15 shows Fizz but no Buzz on newline. Why? Just need clarification

Just trying to understand on why Buzz doesn't appear in the newline after Fizz for 15. Trying to learn JavaScript from Eloquent Javascript and just got into doing the FizzBuzz exercise. Note that I'...
• Java FizzBuzz recursive solution

Attempting a FizzBuzz recursive solution in Java to return a list of Strings with n iterations. For example, n = 4 should output ["1","2","Fizz", 4]. However, with my current code the output is just ["...
• Fizz Buzz Solution: Unexpected Token Function?

I'm having some frustration with this code. I may not be seeing it. I keep getting either an "Unexpected Token" or "ILLEGAL" error (the latter which completely perplexed me, considering I've never ...
• While loop ignores conditionals (if, else) and just prints first suggested print option

I am trying to create a program that prints out a list of numbers starting at 0 and leading up to a number the user inputs (represented by the variable "number"). I am required to use "while" loops to ...
• Unable to understand last condition of FizzBuzz in following code

I can understand how this code produces Fizz , Buzz when divisible by 3 , 5. But confused about how it produces FizzBuzz when divisible by both 3 and 5, because i do not see any if condition which ...
• errors in fizzbuzz in C using String approach?

So I was trying to solve the FizzBuzz challenge in various languages using the string method to improve the code. I got stuck in C because things work differently here. This is my code, I'm getting ...
• FizzBuzz giving back random numbers when using getElementById.innerHTML

Hopefully someone can help me out here. I'm very new to coding and learning to write my first fizzbuzz. My code works when I execute it using console.log, but when I try to use getElementById....
• c# fizzbuzz auto number generator

I have just made a simple game of fizz buzz( its where numbers go up and if divisible by 3 it is called fizz and if divisible by 5 its called buzz, and if divisible by both its called fizz buzz) and ...
• C# FizzBuzz Switch Solution

Is it possible to create the FizzBuzz solution in C# with the switch construct. I've found solutions that work for JavaScript and other languages, but these (or the syntax equivalent) don't seem to be ...
• I am interested in a more optimized solution for sum of all fizzbuzz numbers in a given range

The number fizzbuzz is composed of two numbers that is fizz and buzz. fizz represents the numbers that are divisible by 3 and buzz are the numbers that are divisible by 5. combining both fizzbuzz, ...
• Unexpected Token on FizzBuzz Solution

I would like to console.log to print all the numbers from 1 to 100, with two exceptions. For numbers divisible by 3, print "Fizz" instead of the number, and for numbers divisible by 5 (and not 3), ...
• Need help fixing the output of this Higher Order Function.

function each(arr, fn) { for(var i = 0; i < arr.length; i++){ fn(arr[i]); } } each([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], function(val){ if((val % 3) === 0){ console.log(...
• FizzBuzz Ruby one-liner

Rosettacode.org has this excellent one-line FizzBuzz solution in Ruby. 1.upto(100){|n|puts'FizzBuzz '[i=n**4%-15,i+13]||n} The trouble is, I don’t understand it. The part that puzzles me is the ”n ...
• What is this way of resolving the Fizzbuzz challenged called?

I am new to programming, and I am currently doing the FizzBuzz test, it looks simple at first but we got some requirements to perform it: I can use only one if. No multiple branches, ternary ...
• Difficulty with Fizz Buzz

I'm a high highschool student taking an online course for python, and one of the assignments is to create a function similar to fizz buzz, except instead of "fizz" and "buzz", they simply use "three" ...
• Why not use a while loop for FIZZBUZZ in C? [closed]

Only been coding in C for about a month, but wondered why the while loop wasn't used more often for FIZZBUZZ. Is it not as clean or some other reason? Here's what I came up with: int main() { ...
• Method fail when I follow Ruby rubocop style guide and use .zero? instead of == 0

I am trying to complete a coding exercise in Ruby, which is as follows: TODO: starting with an array of integers, return an array with integers and 'Fizz', 'Buzz' or 'FizzBuzz' Write a method ...
• FizzBuzz for Javascript: How console.log knows when to print one variable or another?

I'm looking at this code: for (let n = 1; n <=100; n++) { let output = ""; if (n % 3 == 0) output += "Fizz"; if (n % 5 == 0) output += "Buzz"; console.log(output || n); } How the console ...
• 'Split' integers in Terminal

In Ruby, I'm trying to solve a quiz as like a FizzBuzz Challenge. My question is "How I can print the integer number |n| adding a comma and space(", ")at the end of they?" To separate the Namaand ...
• In a fizzbuzz, why does a program using dicts think 0 is a fizzbuzz?

So I'm quite new to coding and I was experimenting with all the different fizzbuzzs' and I came across one using dicts. When I run it I can easily make any parameters change with 1 keystroke change, ...
• FizzBuzz test case pass [closed]

I am wondering can someone please tell me where I am going wrong with this FizzBuzz. I get an error "not all code returns a value and struggling to find out exactly how to fix it. My code is below: ...
• It says I need to add “,” in C#, Where do I put it? [closed]

I tried to make a FizzBuzz code in C# but the error code it gives me is that I'm missing a " , " somewhere but I can't find where to place it Also I know there are other underlying programs in the ...
• FizzBuzz Conundrum

The FizzBuzz question is a very classical interview question asked in multiple interviews all around the world. There are many ways to do it in different languages. But in most general terms it ...
• I am doing a fiizzBuzz array and I keep getting a null before my array

public String[] fizzBuzz(int start, int end) { int end1 = end - start; String [] new1 = new String[end]; for(int i = start; i < end; i++) { if(i % 3 == 0 && i % 5 == 0) { new1[i] = ...
• C++ lambda and inlined fizzbuzz

Heoi, I've seen a C++ talk where someone made a lambda fizzbuzz implementation. This is not it! Not even close to it! My question is, why can't I use the ostream& auto fizz = [](int& x, std:...
• fizz buzz game in python

Write a simple function called fizzBuzz that takes in a positive integer, and returns ‘fizz’, ‘buzz’, ‘fizzbuzz’ or the argument it receives, based on the following: Returns ‘fizz’ if the argument is ...
• Grouping of FizzBuzz numbers

I am trying to code FizzBuzz problem in Java8. It is working fine and I am getting desired output. For the number divisible by "3", it should return "Fizz", for the number divisible by "5", it should ...
• Solving FizzBuzz with Keras

I am trying to solve FizzBuzz using Keras and it works quite well for numbers between 1 and 10.000 (90-100% win rate and close to 0 loss). However, if I try even higher numbers, that is numbers ...
• How to write FizzBuzz in JavaScript without using % operator

I know how to write simple FizzBuzz code in JavaScript: x = 0;while (++x < 1000)console.log((x % 3 ? "" : "Fizz") + (x % 5 ? "" : "Buzz") || x); But how can we get the same result ...
• Behaviour of order in the range over map in this Golang program

I am a beginner programmer and was going through some GitHub repositories and found this simple classic fizzbuzz implementation using a map. However when I run it a couple of times it prints buzzfizz ...
• Python seems to make every variable a float

I tried to write a simple fizzbuzz program in python, I tried to use isinstance to determine if a number is a float or a int instead of creating a list, but whenever I try it for some reason it ...