话不多说,直接请大神看代码
import math
def save_money_in_n_weeks(money_per_week, increase_money, total_week):
money_list = [ ] # record list saving money per week
saved_money_list = [ ] # record accumulative money per week
for i in range(total_week):
money_list.append(money_per_week)
saving = math.fsum(money_list)
saved_money_list.append(saving)
money_per_week += increase_money
return saved_money_list
def main():
“”"
main function
"""
money_per_week = float(input('PLease Input Money amount per week: ')) #
increase_money = float(input('PLease Input ncremental amount per week: ')) #
total_week = int(input('Total Week: ')) #
# Using function
saved_money_list = save_money_in_n_weeks(money_in_n_weeks(money_per_week, increase_money, total_week)
week_num = int(input('The Week: '))
# week_num = int(input('please input the week: '))
# week_num = int(input('Please input the week: '))
print('NO{} weeks deposity: {} RMB'.format(int(week_num), saved_money_list[week_sum - 1]))
if name == ‘main’:
main()
错误输出为:
File “路径/test_5.0.py”, line 36
week_num = int(input('The Week: '))
^
SyntaxError: invalid syntax
不知道哪里有问题,请教大神。