basic strings and variables python -
write function, called introduction(name, school) takes, input, name (as string) , school, , returns following text: “hello. name name. have wanted go school.”
this code
def introduction("name","school"): return ("hello. name ") + str(name) + (". have wanted go the") + str(school) + (".")
i'm getting error:
traceback (most recent call last): file "none", line 5, in <module> invalid syntax: none, line 5, pos 23
def introduction("name","school"):
should be
def introduction(name,school):
the names provide formal parameters of function variables values of actual parameters assigned to. including literal value (like string) wouldn't make sense.
when call or invoke function, provide real value (like literal string)
def introduction(name,school): return ("hello. name ") + str(name) + (". have wanted go the") + str(school) + (".") print introduction("brian","mit")
Comments
Post a Comment