2016-10-04 40 views
-2

帮我用这个新的编码即时通讯尝试一个在“使用python无聊的东西”代码如下所示。我一直得到一个TypeError:不能将'NoneType'对象隐式转换为第六行代码

# 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. ') 
+3

'myAge =打印()'。 'print'返回'None'。你想在那里做什么?那应该是'input()'? –

+0

第6行没有任何东西。 –

回答

-1

你的错误似乎是在

myAge = print() 

我相信你希望把

myAge = input() 
+0

他错误地认为你不能在Python中打印变量,就像'myName = print()'一样,因此他得到了NonType错误。 – Tuc3k

相关问题