简体   繁体   中英

Sum of all numbers in range from 0 to a given number that are divisible with 7

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM