Repl.it, practice your Python

Through out this course, you might want to practice and experiment with new knowledge that you learned. For this, you can use Repl.it. REPL stands for Read-eval-print-loop, which is read the command, evaluate, print the result and repeat. It is a computer programming environment that accepts single user inputs, executes it, and returns the result to the user by printing it onto the screen. If you have used your terminal on your computer, you have used a REPL.

Repl.it provides you a REPL environment plus a code editor. The first thing you should do is go there a sign up for an account so you can save your sessions. After that, create a new Python session. Make sure to choose Python3 as the Programming language.

Repl

Click on the language and this should the display.

Repl

The default screen shown hasn't logged in, but you need to create a new account in order to save your work. Do no forget!

On the left side, the white space, is a code editor where you can type a piece of program. On the right, the black space, is a Python REPL. When you finish typing out your program on the left, you can click the run button on the top and the program will be evaluated. Any outputs will be printed on the right, the REPL. Try it out by pasting the following code onto the left, then click run.

print('Hello, world')
print(4 + 5)

Repl

Voila! You are learning Python. As you learn new knowledge, it is recommended that you try to repeat the code in Repl.it and start modifying it until you get comfortable.

The black space, the REPL, is where you can write one line commands or access programs and variables that you have written in the code editor. Let's create a variable called quote and assign it a string in the code editor, then click run again.

quote = 'Our happiness depends on wisdom all the way.'

You might notice that the REPL will output nothing after it evaluates the code. That's because a REPL always has to return something, if there is nothing to return, it will return nothing. Let's not get too deep into that. What I want you to do now, is access the quote variable we created through the REPL. Type out the word quote in the REPL and press ENTER.

Repl

Boom! 'Our happiness depends on wisdom all the way.'. This functionality will appear to be very useful after you have learned how to write functions. Take my word for it for now, you will see. As I said, REPL can take single inputs and evaluate them. Let's try that, type 10+5 into REPL and press ENTER.

Repl

You should get the number 15 returned to you. That's it for now. Remember to use this tool to practice and improve your understanding with each new concept that you learn in this course.

results matching ""

    No results matching ""