Example of how to calculate the sum of series in Python: python Series
This article describes how to calculate the number of series and in Python. We will share this with you for your reference. The details are as follows:
Problem:
Input
There are multiple groups of input data. Each group occupies one row and consists of two integers n (n <10000) and m (m <1000). The meanings of n and m are as described above.
Output
For each group of input data, the sum of the output columns, each test instance occupies a row, requires that the precision be kept with 2 decimal places.
Sample Input
81 4
2 2
Sample output
94.73
3.41
Implementation Code:
Import mathwhile 1: x = raw_input () x = list (x. split ("") data = [int (x [0]),] nums = int (x [1]) for I in range (nums-1): data. append (math. sqrt (data [-1]) print '%. 2f '% sum (data)
The above statement is a bit wordy.
Import mathwhile 1: x = map (int, raw_input (). split ("") data = [int (x [0]),] nums = int (x [1]) for I in range (nums-1): data. append (math. sqrt (data [-1]) print '%. 2f '% sum (data)