i keep getting a TypeError: Can't convert 'NoneType' object to str implicitly on the 6th line of code [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



i keep getting a TypeError: Can't convert 'NoneType' object to str implicitly on the 6th line of code [duplicate]



This question already has an answer here:



help me with this im new to coding im trying a one of the lessons in "Automate the boring stuff with python" the code goes as follows.


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



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





myAge = print(). print returns None. What are you trying to do there? Is that supposed to be input()?
– Morgan Thrapp
Oct 4 '16 at 18:29



myAge = print()


print


None


input()





There is nothing at line 6.
– Christian Dean
Oct 4 '16 at 19:32




1 Answer
1



Your error seems to be in


myAge = print()



print is giving info to stdout, not sending info in. The print method expects at least one parameter of a string to print. To print your variable 'myAge' simply:


print(myAge)





His error it that you cannot print variable in Python like this myName = print(), and because of that he's getting NonType error.
– Tuc3k
Oct 4 '16 at 18:45


myName = print()

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS