Fuzzbuzz prblm, first case is correct but 2nd is wrong,.... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Fuzzbuzz prblm, first case is correct but 2nd is wrong,....

How can i correct my fizzbuzz problem:- n = int(input()) for i in range(1,n,2): if i % 3 == 0: print("Solo") elif i % 5 == 0: print("Learn") elif i % 3 == 0 and i % 5== 0: print("Solo Learn") else: print(i)

2nd Oct 2021, 3:32 AM
Ashish Mishra
Ashish Mishra - avatar
3 Answers
+ 4
Ashish Mishra in third print Statement there is space between Solo and learn see properly what u have to print remove this space
2nd Oct 2021, 3:41 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 4
Hi Ashish! It prints Solo for all numbers that divisible by 15(3 and 5) instead of Solo Learn. That's because, you started your if-else statements with divisible by 3 but 15 is also divisible by 3. For that, you can start with 3 and 5 instead. So, it will check all numbers properly.
2nd Oct 2021, 3:47 AM
Python Learner
Python Learner - avatar
+ 2
I want to solve hidden case .... first case is right but second is wrong....how?
2nd Oct 2021, 3:33 AM
Ashish Mishra
Ashish Mishra - avatar