Any sequence of characters enveloped in quotes (single, double, triple). Your opening quotes need to match your closing quotes.
String literals:
Use variable names:
print()
functionPrint string literals:
Print variables:
Use the +
operator to “glue” strings together:
You can also use +=
to change to retrieve the string assigned to a variable, “glue” another string to it, and assign it back to the same variable name:
Use the keyword def
to define a function use ()
after your function name to list all the parameters.
def repeat_message(message, n):
full_message = message * n
return full_message
message = repeat_message("Hi there", 5)
print(message)
Hi thereHi thereHi thereHi thereHi there