0

Pls what should I change here

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)

3rd Jan 2021, 2:09 PM
خديجة
خديجة - avatar
7 Respuestas
+ 2
《 Nicko12 》 Khadeejah Fahm It is a code coach question .So i think his code fails against certain test cases .There's no problem with his code .Just the for loop should be like : for x in range(1,n,2) : That's it ....
3rd Jan 2021, 3:15 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 1
Khadeejah Fahm It seems to be working fine though. What output do you want?
3rd Jan 2021, 3:09 PM
noteve
noteve - avatar
+ 1
Alphin K Sajan Oh you're right, now I remember it should iterate odd numbers only.
3rd Jan 2021, 3:16 PM
noteve
noteve - avatar
+ 1
3rd Jan 2021, 3:17 PM
Alphin K Sajan
Alphin K Sajan - avatar
0
Khadeejah Fahm Change the for loop
3rd Jan 2021, 2:12 PM
Alphin K Sajan
Alphin K Sajan - avatar
0
Thanks
3rd Jan 2021, 2:19 PM
خديجة
خديجة - avatar
- 1
Depends on what you want the code to do? 🤔
3rd Jan 2021, 2:20 PM
Lisa
Lisa - avatar