+ 1

Guys will you please help me to understand fizz buzz in python

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. n = int(input()) for x in range(1, n): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") continue elif x % 3 == 0: print("Solo") elif x % 5 == 0: print("Learn") continue else: print(x)

2nd Nov 2020, 11:04 AM
6 Antworten
+ 13
M.sharmila , as this task might be a code coach exercise, please show us your attempt. Please link your code here. Thanks!
2nd Nov 2020, 11:37 AM
Lothar - avatar
+ 11
If you need help, you can post the code you're struggling with. Try to search for similar questions or answers. ┬áÔÇó https://www.sololearn.com/post/75089/?ref=app
2nd Nov 2020, 12:58 PM
Danijel Ivanovi─ç
Danijel Ivanovi─ç - avatar
+ 5
You forgot to say what is it that you didn't understand. You can write that part in the Description ÔśŁ
2nd Nov 2020, 11:22 AM
+ 4
create code and link on your code with your question, better remove this topic and create new topic with your code
2nd Nov 2020, 11:43 AM
Sergey - avatar
+ 2
a lot of same replies, but no help at all, all parties should maybe slow down with comments, especially if they are the same as previous ones...
13th Jan 2021, 8:11 PM
VenomLess - avatar
12th Jan 2021, 6:30 PM
Syd Gestwite
Syd Gestwite  - avatar