累加必有初始化
1. format()
(各位数之和类)
s = input("请输入一个小数: ")
s = s[::-1]
____________
for c in s:
if c == '.':
____________
cs += eval(c)
print('{____________}'.format(cs))
s = input("请输入一个小数: ")
s = s[::-1]
cs = 0
for c in s:
if c == '.':
break
cs += eval(c)
print('{:*>10}'.format(cs))
- 技巧:有累加必有初始化
2. for 的嵌套循环(外层+内层
)
std = [['张三',90,87,95],['李四',83,80,87],