0

Help me please(Python)

n = int(input()) for x in range(1, n): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 3 == 0: print("Solo") elif x % 5 == 0: print("Learn") elif x % 2 == 0: continue else: print(x) This is my code help me I can't do FizzBuzz.

7th Jan 2023, 1:50 PM
Misterio
Misterio - avatar
4 Answers
+ 1
The syntax of your code is correct but the semantic is wrong. You just need to rearrange the conditions. n = int(input()) for x in range(1, n): if x % 2 == 0: continue elif x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 3 == 0: print("Solo") elif x % 5 == 0: print("Learn") else: print(x)
7th Jan 2023, 2:18 PM
iTech
iTech - avatar
0
Include what you are asked to do so that we can provide you precise solution. I do not remember FizzBuzz exercise.
7th Jan 2023, 2:02 PM
iTech
iTech - avatar
0
If number % 3 ==0 print world Solo. If nunber % 5 print Learn. If number % 3 and %5 print SoloLearn. If number isn't odd it must be continued and not printed. P.s. If you don't understand something sorry,I don't know English excellent.
7th Jan 2023, 2:07 PM
Misterio
Misterio - avatar
0
You need to exclude even numbers at the very beginning: if x % 2 == 0: continue
7th Jan 2023, 2:30 PM
Solo
Solo - avatar