Write a function, called introduction(name, school) that takes, as input, a name (as a string) and a school, and returns the following text: “Hello. My name is name. I have always wanted to go to school.”
This is my code
def introduction("name","school"):
return ("Hello. My name is ") + str(name) + (". I have always wanted to go to The") + str(school) + (".")
I'm getting this 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 you provide as the formal parameters of the function are essentially variables that the values of the actual parameters get assigned to. Including a literal value (like a string) wouldn't make much sense.
When you call or invoke the function, that is where you provide a real value (like a literal string)
def introduction(name,school):
return ("Hello. My name is ") + str(name) + (". I have always wanted to go to The") + str(school) + (".")
print introduction("Brian","MIT")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With