PythonLesson 1 of 16
Your first program: print and comments
Every program starts by saying something. In Python that is the job of print(), which shows text on the screen.
Key points
- print("...") shows text; each call starts a new line
- Text goes in quotes: "double" or 'single'
- Values separated by commas are printed with spaces between them
- sep sets the separator, end sets what closes the line
- Everything after # is a comment, and Python ignores it
Example
# A comment: Python skips this lineprint("Hello, world!")print("Python", "is", "fun")print("8:00", "20:00", sep=" - ")Three print calls give three lines. The second line joins values with spaces, the third uses the separator from sep.
Task
How to use the editor⌘ Enter or Ctrl Enter runs the code, ⇧ ⌘ Enter checks the task.Tab and Shift Tab indent the line or the selection; Esc, then Tab leaves the editor.The check compares what the program printed with the task; spaces at line ends do not matter.After two failed checks you may open the solution. Your code is kept in this browser.Finish the coffee shop sign. Under the name, print two more lines: Open 8:00-20:00 and Welcome!
Output
What your program prints appears here.