【发布时间】:2017-10-10 15:03:52
【问题描述】:
有人可以帮我修复这个 TypeError 吗?我正在尝试将 5 提高一个数字 n 并打印其最后 2 位数字
from sys import stdin, stdout
n = [int(x) for x in stdin.readline().rstrip().split()]
l = 5**n
res = str(l)
stdout.write(res(2)+res(1))
【问题讨论】:
-
如果您要对 One 号码执行此操作,为什么要使用 split() 和列表?
-
查看错误。它说什么?现在看看
5**n。n是一个列表。您不能将列表用作指数。你需要问问自己你想做什么。你也许想要[5**v for v in n]?或者5**n[0]?还是别的什么?
标签: python typeerror python-3.6