+ 2

Why this is not working

inp = input() print(len(inp)-1) for i in inp: i = int(i) if i % 2 != 0: if i % 3 == 0 and i % 5 == 0: print("SoloLearn") elif i % 3 == 0: print("Solo") elif i % 5 == 0: print("Learn") else : print(i)

16th Oct 2020, 12:52 PM
Mr. Beast
Mr. Beast - avatar
2 Answers
+ 4
1. int(input()) in line 1 instead of input() 2. Remove line 2 3. line 3 => for i in range(1,inp,2) 4. If you follow the 3rd point, there's no need of "if i%2!=0" Fixed 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)
16th Oct 2020, 2:11 PM
Namit Jain
Namit Jain - avatar
+ 2
youre checking against numbers in your if statements. input() defaults to a string
16th Oct 2020, 12:54 PM
Slick
Slick - avatar