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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.