- 1

Python

Hello.. i need help coding a prog. for listing even numbers within a particular range say 100...thn listing numbers divisible by say 3....within the same range.

1st Mar 2017, 7:03 AM
syd
4 Antworten
+ 1
do you want to code us? or need any specific help?
1st Mar 2017, 7:31 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
do you want us to code for you? or need any specific help?
1st Mar 2017, 7:31 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
for i in range(100): if i % 2 == 0: # This gets all even numbers 0-100 print(i) if I % 3 == 0: # This gets all numbers divisible by 3 0-100 print(i) You can modify this as needed to print or add numbers to a list etc. Or for i in range(0, 100, 2): print(i) for i in range(0, 100, 3): print(i)
1st Mar 2017, 7:33 AM
ChaoticDawg
ChaoticDawg - avatar
0
yeah... i need the exact code, if you don't mind. thanks in advance.
1st Mar 2017, 7:33 AM
syd