+ 1

I tried solving the FizzBuzz challenge in Python(Sololearn) but it's saying my code is incorrect, there's no error

FizzBuzz challenge

9th Nov 2022, 8:58 AM
ADESINA PSALMLORD
ADESINA PSALMLORD - avatar
7 Antworten
+ 2
n = int(input()) for x in range(1,n): if x%2==0: continue else: if x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 3 == 0: print("Solo") elif x % 5 == 0: print("Learn") else: print(x)
10th Nov 2022, 6:55 PM
Sreeja Pandraju
+ 9
ADESINA PSALMLORD , there are 2 issues: > the output for the condition: `if x%3==0 and x%5 ==0:` should be 'SoloLearn' not 'Sololearn' > the complete conditional statement `if x%3==0 and x%5 ==0:` should be the first one to evaluate. if we have it as the last condition, it could never be reached since `elif x%5 ==0:` or `elif x%3 == 0:` will be evaluated first. see the code in the file. https://code.sololearn.com/c5ZUuQnVhI9W/?ref=app
9th Nov 2022, 11:35 AM
Lothar
Lothar - avatar
+ 2
The two unlocked conditions are met but there's a locked condition saying my code is incorrect n =int(input( )) for x in range(1 , n): if x%2 != 0: if x%3 == 0: print("Solo") continue elif x%5 ==0: print("Learn") continue elif x%3==0 and x%5 ==0: print("Sololearn") else: print(x) Someone should please help
9th Nov 2022, 8:59 AM
ADESINA PSALMLORD
ADESINA PSALMLORD - avatar
+ 2
ADESINA PSALMLORD Remove the continue statements and run the code..it works
9th Nov 2022, 9:23 AM
Riya
Riya - avatar
+ 1
It's still stated that the locked condition is not met Have you solved the challenge?
9th Nov 2022, 9:37 AM
ADESINA PSALMLORD
ADESINA PSALMLORD - avatar
0
Thanks
10th Nov 2022, 7:21 PM
ADESINA PSALMLORD
ADESINA PSALMLORD - avatar