Python 我一直收到一个打字错误:Can';t转换为';非类型';对象隐式地在代码的第6行上创建str
请帮助我,我是一名新的编程人员,我正在尝试“用python自动化无聊的东西”中的课程之一。代码如下所示Python 我一直收到一个打字错误:Can';t转换为';非类型';对象隐式地在代码的第6行上创建str,python,Python,请帮助我,我是一名新的编程人员,我正在尝试“用python自动化无聊的东西”中的课程之一。代码如下所示 # this program says hello and asks for my name. print('hello world!') print('what is your name?') # ask for their name myName = input() myName = print() print('it is good to meet you,' + myNam
# this program says hello and asks for my name.
print('hello world!')
print('what is your name?') # ask for their name
myName = input()
myName = print()
print('it is good to meet you,' + myName)
print('the length of your name is:')
print(len(myName))
print('what is your age?') # ask for their age
myAge = print()
print('you will be ' + str(int(myAge) + 1) + ' in a year. ')
你的错误似乎是错误的
myAge = print()
print正在向标准输出提供信息,而不是发送信息。print方法要求至少打印一个字符串参数。要简单地打印变量“myAge”:
print(myAge)
myAge=print()
<代码>打印返回无
。你想在那里做什么?这应该是input()
?第6行没有任何内容。他的错误是您不能像这样在Python中打印变量myName=print()
,因此他得到了非类型错误。