0
Please send me code of game FizzBuzz
4 Respostas
+ 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.
+ 3
The length of my answer is limited by Sololearn. I did use search and found more than a hundred codes that are right for your specification:
https://code.sololearn.com/cSztiOrx3f7s/?ref=app
https://code.sololearn.com/c7eB8MZZjV2I/?ref=app
https://code.sololearn.com/cFt2b51AvYBq/?ref=app
https://code.sololearn.com/cdw0a6tYScks/?ref=app
https://code.sololearn.com/clO8E2ENQfJP/?ref=app
https://code.sololearn.com/cyT0s1WUaFlP/?ref=app
https://code.sololearn.com/cC0CdU2lqCa2/?ref=app
https://code.sololearn.com/c9D6jAOAmf3x/?ref=app
https://code.sololearn.com/cKhL6dLxklRH/?ref=app
https://code.sololearn.com/csSjqeB2cnma/?ref=app
https://code.sololearn.com/ct6ipcnEzYgR/?ref=app
https://code.sololearn.com/c157h18NKuGb/?ref=app
https://code.sololearn.com/cmWduWJZ3R62/?ref=app
https://code.sololearn.com/cp7l67VVJ8r7/?ref=app
https://code.sololearn.com/cYW3bRtr5c2l/?ref=app
https://code.sololearn.com/cnXGiM9gsmY0/?ref=app
+ 1
Ask chatgpt
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