- 1
n = int(input()) for x in range(1, n): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 3 == 0:
I just need help with this Don't help me tho Just give me an hint on what to do Just don't tell me the answer or give me a solution. Put me through 😔
14 Respuestas
+ 2
Gold samuel
Change your for loop to skip those numbers which are multiple of 2.
So just change your loop like this:
for x in range(1, n, 2):
Here is complete solution of your code:
----
n = int(input())
for x in range(1, n, 2):
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)
+ 2
CLAD Oh Oh Oh Oh I see now 😅
Thanks mate
+ 1
elif code block is not added
+ 1
lisa I guess that's a sololearn code coach fizz-buzz variation ;)
+ 1
x%3== 0 and x%5 == 0 -> multiple of 15
x%3== 0 -> multiple of only 3
x%5== 0 -> multiple of only 5
if n is 16 we have the following situations:
- multiples of only 5 are 5, and 10
in this case prints "Learn"
- multiples of only 3 are 3,6,9, and 12
in this case prints "Solo"
- multiples of 15 are 15
in this case prints "SoloLearn"
in other cases just print the rest number:
1,2, 4, 7, 8, 11, 13, and 14
0
your code is incomplete: I don't know if that's because of field text length limit or the point where you stuck... maybe could you provide the requirements / behavior expected?
0
your code looks like a number which is divisible by both 3 and 5 which is equivalent to 15.
0
from code coach requirements:
"You need to change the code to skip the even numbers, so that the logic only applies to odd numbers in the range."
good reading the description of the problem can save a lot of time and neurons use ;P
0
🅰🅹 🅐🅝🅐🅝🅣 Thanks a lotttttt
I'd try it now ✨
0
visph
Thankssss ✨
I understand now
0
n = int(input())
for x in range(1, n, 2):
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:
continue you can't miss this statement, guys
else:
print(x)
0
n = int(input())
for x in range(1, n):
if x % 2 == 0;
print("")
continue
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)
- 3
Djhekxbwmzmdeme