相关疑难解决方法(0)

错误:'int'对象不可订阅

我正在尝试一段简单的代码,得到别人的名字和年龄,让他/她知道他们什么时候年满21岁......不考虑否定和所有这些,只是随机的.

我一直收到这个'int' object is not subscriptable错误.

name1 = raw_input("What's your name? ")
age1 = raw_input ("how old are you? ")
x = 0
int([x[age1]])
twentyone = 21 - x
print "Hi, " + name1+ " you will be 21 in: " + twentyone + " years."
Run Code Online (Sandbox Code Playgroud)

python type-conversion python-2.7

40
推荐指数
4
解决办法
37万
查看次数

标签 统计

python ×1

python-2.7 ×1

type-conversion ×1