Can anyone help me with Fizzbuzz project of python!

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) How can I modify this above written code to skip even numbers? Please help me with this.....

12th Apr 2022, 6:20 PM
Shaibal Mitra
2 Réponses
+ 4
Hi Shaibal Mitra ! With range you can specify the step length. Set it to 2.
12th Apr 2022, 6:36 PM
Per Bratthammar
Per Bratthammar - avatar
+ 2
Shaibal Mitra since this exercise is the final one in chapter "control structure", we should take the opportunity to modify the current control structure. we can start with the if condition, that should check if the current number is an even number. if this is True, we can use continue to skip the rest of the conditional statements, and execute the next loopmiteration.
12th Apr 2022, 6:42 PM
Lothar - avatar