+ 1
I tried solving the FizzBuzz challenge in Python(Sololearn) but it's saying my code is incorrect, there's no error
FizzBuzz challenge
7 Respostas
+ 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)
+ 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
+ 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
+ 2
ADESINA PSALMLORD Remove the continue statements and run the code..it works
+ 1
It's still stated that the locked condition is not met
Have you solved the challenge?
0
Thanks