1. Ready, set, goTo do
Print Ready...Set...Go! using one call to print with three separate arguments. Let sep do the joining.
| Input | Output |
|---|---|
| (no input) | Ready...Set...Go! |
Module 0 · Functions, Variables · Lesson 1 of 5
A function is an action Python already knows how to perform. You call it by writing its name followed by parentheses. Whatever you put inside the parentheses is an argument: the input you hand to the function.
print("hello, world")
Text in quotes is a string (str). Forget a quote or a parenthesis and Python stops with a SyntaxError. That's normal: everyone hits it daily.
print accepts several arguments separated by commas, and joins them with a space. It also has two named parameters with default values:
sep=" " is what goes between arguments.end="\n" is what goes after the last one. \n means "new line".Reading the docs is a real skill. The official signature is print(*objects, sep=' ', end='\n'). The * means "any number of arguments".
What does print("A", "B", sep="") show?
What is the default value of print's end parameter?
Which line causes a SyntaxError?
Print Ready...Set...Go! using one call to print with three separate arguments. Let sep do the joining.
| Input | Output |
|---|---|
| (no input) | Ready...Set...Go! |
Use two calls to print that together show hello, world on a single line.
| Input | Output |
|---|---|
| (no input) | hello, world |