Your first program in Python
Learn to write Python script and install third party packages using pip.
Last updated
Learn to write Python script and install third party packages using pip.
Last updated
Code App comes with many built-in languages including C++, Python and others. To see the full list, click the link below:
Supported LanguagesLet's start by creating a Python source file. Expand the file explorer side bar and select the new file icon (document with a plus icon). You can either use the built in template or enter a custom file name to create an empty file.
For now, let's use the built in template.
You should now see the hello world program written in Python. Tap the play button to run it.
Congratulations! You now ran your first program on Code App.
Third party modules allow you to do awesome things, including making network requests to a web server, drawing charts to analysis data, or downloading a YouTube video.
Code App comes with the pip
command in the terminal. To install a modules, just type pip install <module name>
in the terminal.
Note that not all modules work on Code App, see the FAQ for more.
In this example, we will try out the requests
module. It allows Python to make network requests to web servers. Let's try to get the list of people currently in the space.
Tap on the chevron button to bring up the terminal and type pip install requests
in the terminal.
Copy the following code to your source file and click run:
Cool! You now have the list of all astronauts currently on their mission in the space.