Please send me code of game FizzBuzz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please send me code of game FizzBuzz

11th Mar 2023, 11:54 AM
Samirbek G'ulomov
Samirbek G'ulomov - avatar
4 Answers
+ 8
What is a FizzBuzz game? Sololearn is not a code writing service. If you need help with a coding task, give the complete task description and your own code attempt.
11th Mar 2023, 12:07 PM
Lisa
Lisa - avatar
+ 1
Ask chatgpt
11th Mar 2023, 10:08 PM
Oma Falk
Oma Falk - avatar
0
The given code solves the FizzBuzz problem and uses the words "Solo" and "Learn" instead of "Fizz" and "Buzz". It takes an input n and outputs the numbers from 1 to n. For each multiple of 3, print "Solo" instead of the number. For each multiple of 5, prints "Learn" instead of the number. For numbers which are multiples of both 3 and 5, output "SoloLearn". You need to change the code to skip the even numbers, so that the logic only applies to odd numbers in the range. ====================== Several points: 1. takes an input n and outputs the numbers from 1 to n. means you should use a for loop and range function generally 2. multiple of 3 means `number % 3 == 0` and so does multiple of 5 3. multiples of both 3 and 5 means `number % 3 == 0 and number % 5 == 0` or just `number % 15 == 0` for short 4. to skip the even numbers you can use condition of `number % 2 == 0` and `continue` statement or `range(1, n, 2)` with a step to do the trick
12th Mar 2023, 2:16 PM
o.gak
o.gak - avatar