+ 2
Vinit You just need to add "2" in the range to skip the even numbers
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)
+ 4
Please show us your attempt so far so we may see and fix your problem. Thanks.
+ 4
I think based on the problem, we only need to output odd numbers, therefore you also have to iterate odd numbers.
for x in range(1, n, 2):
range(start, end, step)
Here the step is 2 means that it will iterate by 2 steps.
And now this will just iterate the odd numbers.
+ 2
What is the actual question ??
what are the conditions of the code?



