-->
当前位置:首页 > 题库

PROGRAMMING:Python - splitting and summation of multiline strings

Luz5年前 (2021-05-10)题库515
Write a program to count the sum of several integers in each line of string. The separator between integers in each line of string may have;, How many lines are there.
###Input format:
First, enter the number of rows to be processed, N, and then enter a string of integers separated by commas, spaces, or semicolons. The number of tests ensures that there is at least one line of data, and the integer data in the string is valid.
###Output format:
Corresponding to the output of the original input string (character sequence in a line), the colon is followed by the sum of all integers.
###Input example:
```in
four
1; 2 ,3
2 3; four
10,20 30; forty
nine
```
###Output example:
```out
1; 2 ,3:6
2 3; 4:9
10,20 30; 40:100
9:9
```







answer:If there is no answer, please comment