Python练习Tommy wants to improve his programming skills by solving as many programming questions as he can inone month.On the first day,he solved six questions; on the second day,he solved eight; on the third day,hesolved ten.If he can keep up the

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 04:54:28
Python练习Tommywantstoimprovehisprogrammingskillsbysolvingasmanyprogrammingquestionsashecaninonemonth.

Python练习Tommy wants to improve his programming skills by solving as many programming questions as he can inone month.On the first day,he solved six questions; on the second day,he solved eight; on the third day,hesolved ten.If he can keep up the
Python练习
Tommy wants to improve his programming skills by solving as many programming questions as he can in
one month.On the first day,he solved six questions; on the second day,he solved eight; on the third day,he
solved ten.If he can keep up the pace – every day solving two more questions than the previous day,how many
questions in total will Tommy be able to solve in a month of 30 days?Write a Python program to calculate and
print the result.Note:your solution must use loop rather than a single mathematical formula to solve this
question.
Python2.7版本

Python练习Tommy wants to improve his programming skills by solving as many programming questions as he can inone month.On the first day,he solved six questions; on the second day,he solved eight; on the third day,hesolved ten.If he can keep up the
sum = 0
for i in xrange(30):
    sum += 6 + 2 * i
print sum