Python won't tell my name. How can I make it to tell my name? -
name = input ("hey, what's name ?") print ("so, name is") + name the result is:
hey, what's name ?robert so, name traceback (most recent call last): file "c:/users/angel'94/desktop/sal.py", line 2, in <module> print ("so, name is") + name typeerror: unsupported operand type(s) +: 'nonetype' , 'str' i space when i'm entering name after question mark.
you need first build string, then pass result print():
print("so, name " + name) what did first print "so, name is", , print() function returns none when done. tried add name none return value.
instead of using concatenation, pass name in argument print() function:
print("so, name is", name) and function insert space between 2 arguments you.
to space on prompt, add input() argument:
name = input("hey, what's name? ") # space here ^
Comments
Post a Comment