n = int(input()) for x in range(1, n): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 3 == 0: | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
- 1

n = int(input()) for x in range(1, n): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 3 == 0:

Python quiz. How do I skip the even numbers and print old numbers

5th Dec 2020, 7:44 AM
Augustine Ansah Owusu
Augustine Ansah Owusu - avatar
2 Antworten
+ 7
Augustine Ansah Owusu Kindly remove those unwanted links!
5th Dec 2020, 7:55 AM
Piyush
Piyush - avatar
+ 5
You can use "for x in range(1,n,2)" instead of "for x in range(1,n)" . Then loop will iterate only for 1,3,5,..etc. odd numbers :-)
5th Dec 2020, 8:18 AM
Lae