为什么会发生这个错误?类型错误:只能将 str(不是“int”)连接到 str

阿钦蒂亚·帕斯里查

这是我的 Python 代码,我想知道错误的原因

类型错误:只能将 str(不是“int”)连接到 str

正在发生,以及如何解决它:

import random
print("Welcome to the Text adventures Game\nIn this Game you will go on an amazing adventure.")
print("Following are the rules:\n1.You can type the directions you want to go in.\n2. There will be certain items that you will encounter. You can type grab to take it or leave to leave it\n3.In the starting, we will randomly give you 3 values. It is your choice to assign them to your qualites.\nYour Qualities are:\n1.Intelligence\n3.Attack\n4.Defence\n These Qualities will help you further in the game")
print("With these, You are all set to play the game.")
Name=input(str("Please Enter Your Name: "))
a=input("Hi "+Name+", Ready To Play The Game?: ")
Intelligence=0
Attack=0
Defence=0
if a=="yes"or a=="y":
    value1=random.randint(0,100)
    choice1=input("Your Value is: \n"+value1+ "\nYou would like to make it your Intelligence,Attack Or Defence level? ")
海岸

您正在尝试添加intstring

试试这个

if a=="yes"or a=="y":
    value1=random.randint(0,100)
    choice1=input("Your Value is: \n"+str(value1)+ "\nYou would like to make it your Intelligence,Attack Or Defence level? ")

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

类型错误:只能将 str(不是“字节”)连接到 str

TypeError:只能将str(不是“ int”)连接到str SUM

只能将 str (不是“int”)连接到 str

创建列表只能将 str(而不是“int”)连接到 str

类型错误:只能将列表(不是“str”)连接到列表

错误:TypeError:只能将 str(不是“NoneType”)连接到 str

如何解决TypeError:只能将str(而不是“ int”)连接到pyhton中的str错误?

类型错误:循环字典时只能将 str(不是“元组”)连接到 str

类型错误:在 Python 中只能将 str(而不是“字节”)连接到 str

Python:类型错误:只能将 str(不是“列表”)连接到 str

字符串连接TypeError:只能将str(而不是“ int”)连接到str“

我不知道为什么我在这里得到“只能将 str(而不是“int”)连接到 str”错误

错误列出列表中的项目数量。TypeError:只能将str(而不是“ int”)连接到str

TypeError:只能将str(而不是“ numpy.int64”)连接到str

我该如何解决“ TypeError:只能将str(而不是“ int”)连接到str”

我收到TypeError:只能将str(而不是“ int”)连接到str

Python 体素只能将 str(而不是“int”)连接到 str

'TypeError: 访问嵌套列表时只能将 str(而不是“int”)连接到 str'

添加到从文件读取的值时,获取“只能将 str(而不是“int”)连接到 str”

Python TypeError:只能将 str(而不是“字节”)连接到 str

TypeError:只能将str(而不是“ float”)连接到str

python 3:只能将str(而不是“ bytes”)连接到str

只能将str(而不是“ NoneType”)连接到str!怎么了

Scrapy - TypeError:只能将 str (不是“列表”)连接到 str

LightRun Python 代理错误:TypeError:只能将 str(不是“NoneType”)连接到 str

如何解决错误只能将str(而不是“ bytes”)连接到str

在python3中出现错误“只能将str(不是“dict”)连接到str”

在python中遇到问题:显示错误只能将str(不是“bool”)连接到str

TypeError:只能将str(而不是“ int”)连接到str,但是当尝试将var更改为str时,出现了另一个错误