First line would ask the user to give a number. The program should give a sum from 0 to that number of numbers that are divisible by 7.
Asked
Active
Viewed 216 times
-2
-
1Welcome to Stack Overflow! You seem to be asking for someone to write some code for you. Stack Overflow is a question and answer site, not a code-writing service. Please [see here](https://stackoverflow.com/help/how-to-ask) to learn how to write effective questions – azro May 10 '21 at 15:38
-
Just googled "python sum numbers divisible by x" : https://stackoverflow.com/questions/21277824/sum-of-all-numbers-within-a-range-without-numbers-divisible-by-x-in-python – azro May 10 '21 at 15:40
-
To know whether the number is divisible by 7, use: `num % 7 == 0`, if it returns true number is divisible by 7. Goodluck witht he code – Muhd Mairaj May 10 '21 at 15:40
-
How do I get the sum of numbers in the sequence? – LordOfDarkness May 10 '21 at 15:54
1 Answers
0
Without writing any code for you, I can say that you'll need to look into the sum()
function, the modulo %
and equality ==
operators, input()
, and range()
.
There are many wonderful tutorials on the basics of Python and programming in general, and you can find them pretty easily with a Google search.

piccoloser
- 181
- 1
- 10