fork download
  1. # your code goes here
  2. # 题目2:数字位数统计
  3. # 要求:输入一个整数,统计它的位数并输出各位数字之和。
  4. # python
  5. # 复制下载
  6. # # 示例:输入 123 → 输出 "3位数,各位和=6"
  7. a = int(input())
  8. x=a//100
  9. y=a%100//10
  10. z=a%100%10
  11. s=x+y+z
  12. print(s)
Success #stdin #stdout 0.11s 14164KB
stdin
123
stdout
6