+ 1

# Fizzbuzz problem

Can someone please help me? I enter this code; the output is similar to that produced by Sololearn, yet, something is improper, (it remains red). n = int(input()) for x in range(1, n): if x % 2 == 0: continue elif x % 3 == 0: print("Solo") elif x % 5 == 0: print("Learn") else: print(x)

4 Réponses

+ 6

Read the task description carefully: You also need to check if a number is divisible by 3 AND 5

+ 1

Consider the order of the condition: the 4th will never be reached because if number is divisible by 3 or 5 it will already "drop out" in the previous condition.
That means you need to check your now 4th condition before you check divisibility by 3 and 5

0

Catherine
There is one more condition to print "Sololearn"

- 1

Thank you for your advice. Including when I type this code, I only get the case #1 approved, (the 2nd case, for some reason, remains locked).
n = int(input())
for x in range(1, n):
if x % 2 == 0:
continue
elif x % 3 == 0:
print("Solo")
elif x % 5 == 0:
print("Learn")
elif x%5 == 0 and x%3 == 0:
print("SoloLearn")
else:
print(x)