+ 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)
18th Feb 2021, 3:33 AM
RaFHaaN
RaFHaaN - avatar
+ 4
Please show us your attempt so far so we may see and fix your problem. Thanks.
13th Feb 2021, 10:32 AM
Nicko James Barata
Nicko James Barata - avatar
+ 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.
13th Feb 2021, 10:36 AM
Nicko James Barata
Nicko James Barata - avatar
+ 2
What is the actual question ?? what are the conditions of the code?
14th Feb 2021, 5:22 PM
Hemant Kosrekar
Hemant Kosrekar - avatar