Course 1.1Lesson 1 of 5
Every program on this site runs in a code box in your browser, with nothing to install. A code box has the code, the buttons Run, Reset and Copy, an Input box for the answers to input(), and an output area for the results and the error messages. Change the code and press Run as often as you like. Press Reset to go back to the first code. Use straight quotation marks, and refresh the page if Python fails to load.
Try the code and the simulations beside the lesson.
After this lesson you can
Every program in this book runs right here, in your browser. There is nothing to install, and you do not need an account to run code. Python works on a computer, a tablet and a phone.
This is how we learn on this site: you read a little, you run a program, you change it, and you see what happens. Reading about programming is like reading about swimming. You learn it when you get into the water.
input(). Type your answers here, one on each line. You will use it in Chapter 4. If you do not see it, press + Input.Press Run. The first time, it may take a few seconds, because Python is loading in your browser. After that, it is fast. Then change a word inside the quotation marks, for example first to very first, and press Run again.
What happened? You changed the text, and the output changed. The program does exactly what its lines say, nothing more and nothing less. This is the most important idea in the whole book.
You cannot break anything in a code box. If the code goes wrong, press Reset. So be brave, and try these, one at a time.
print("My name is") and then your name in quotation marks. Run it.# at the start. Run it. What happens to that line? (We study comments in the next lesson.)When you want to change the code for real, press Run this code. It opens in a full code box, where you can change anything.
" or '. Curly quotation marks from a word processor, “ ”, give an error.( ) [ ] { } " * # are often on the second or third keyboard page.Later, you may want to keep your programs as files, or to work without the internet. Chapter 6 shows how to install Python on Windows, macOS and Linux. You can finish Chapters 1 to 5 without it.
Start with two quick questions. Each New numbers gives you a fresh one, so you can practise as long as you like.
input() go in the Input box, one on each line.Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
input()?Every lesson is open to read. Enrolling also lets you:
Log in to join the discussion.
Loading…
This lesson is free to read. Enroll free to keep your place and take the tests.