- 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 😔

3rd Jun 2021, 12:14 PM
Gold samuel
Gold samuel - avatar
14 odpowiedzi
+ 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)
3rd Jun 2021, 1:04 PM
A͢J
A͢J - avatar
+ 2
CLAD Oh Oh Oh Oh I see now 😅 Thanks mate
3rd Jun 2021, 2:10 PM
Gold samuel
Gold samuel - avatar
+ 1
elif code block is not added
3rd Jun 2021, 12:23 PM
lisa
+ 1
lisa I guess that's a sololearn code coach fizz-buzz variation ;)
3rd Jun 2021, 12:27 PM
visph
visph - avatar
+ 1
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") else: print(x) visph lisa Maybe you can view it well now
3rd Jun 2021, 12:39 PM
Gold samuel
Gold samuel - avatar
+ 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
3rd Jun 2021, 12:53 PM
CLAD
CLAD - avatar
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?
3rd Jun 2021, 12:22 PM
visph
visph - avatar
0
your code looks like a number which is divisible by both 3 and 5 which is equivalent to 15.
3rd Jun 2021, 12:25 PM
lisa
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
3rd Jun 2021, 12:45 PM
visph
visph - avatar
0
🅰🅹 🅐🅝🅐🅝🅣 Thanks a lotttttt I'd try it now ✨
3rd Jun 2021, 2:09 PM
Gold samuel
Gold samuel - avatar
0
visph Thankssss ✨ I understand now
3rd Jun 2021, 2:10 PM
Gold samuel
Gold samuel - avatar
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)
2nd Jan 2022, 10:56 AM
josé manuel
josé manuel - avatar
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)
12th Jul 2022, 12:47 PM
Arjun Lahane
Arjun Lahane - avatar
- 3
Djhekxbwmzmdeme
5th Jun 2021, 1:18 AM
Diganta Ghosh
Diganta Ghosh - avatar