1
2
3
4
5
6
7
8
9
|
try : while True : n = input () s = 1 for x in raw_input ().split(): s = s + int (x) print s except EOFError: exit() |
求乘
1
2
3
4
5
6
7
8
9
|
try : while True : n = input () s = 1 for x in raw_input ().split(): s = s * int (x) print s except EOFError: exit() |
以上这篇python 输入一个数n,求n个数求乘或求和的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/aaakirito/article/details/79306546