0% found this document useful (0 votes)
100 views8 pages

Python 2.0

The document provides an overview of various online resources for learning Python, including tutorials, books, language references, online interpreters, documentation, forums, and mailing lists. It also discusses using the Python shell, codepads, and IDEs like IDLE from the command line on different operating systems to practice Python coding.

Uploaded by

Anoosha Anwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views8 pages

Python 2.0

The document provides an overview of various online resources for learning Python, including tutorials, books, language references, online interpreters, documentation, forums, and mailing lists. It also discusses using the Python shell, codepads, and IDEs like IDLE from the command line on different operating systems to practice Python coding.

Uploaded by

Anoosha Anwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

On top of search results, here are some good programming resources available online:

 The official Python tutorial. This tutorial is designed to help people teach themselves Python.
While it goes in a different order than the one we're taking here, it covers a lot of the same
subjects that we explore in this course. You can refer to this resource for extra information on
these subjects.

 The Think Python book. This book aims to teach people how to program in Python. It's available
online in PDF and browsable forms. Again, you can use this resource to learn more about some
of the subjects we cover.

The official language reference. This is a technical reference of all Python language components.
At first, this resource might be a little too complex, but as you learn how Python works and how
it’s built, this can be a useful reference to understand the details of these interactions.

Python practice resources

In the meantime, you can still practice by using one of the many online Python interpreters or
codepads available online. There’s not much difference between an interpreter and a codepad.
An interpreter is more interactive than a codepad, but they both let you execute code and see the
results.

Below, you’ll find links to some of the most popular online interpreters and codepads. Give them
a go to find your favorite.

 https://www.python.org/shell/
 https://www.onlinegdb.com/online_python_interpreter
 https://repl.it/languages/python3
 https://www.tutorialspoint.com/execute_python3_online.php
 https://rextester.com/l/python3_online_compiler
 https://trinket.io/python3

Additional Python resources

While this course will give you information about how Python works and how to write scripts in
Python, you’ll likely want to find out more about specific parts of the language. Here are some
great ways to help you find additional info:

 Read the official Python documentation.


 Search for answers or ask a question on Stack Overflow.
 Subscribe to the Python tutor mailing list, where you can ask questions and collaborate with
other Python learners.
 Subscribe to the Python-announce mailing list to read about the latest updates in the language.
Resources
For additional Python practice, the following links will take you to several popular online
interpreters and codepads:

 Welcome to Python

 Online Python Interpreter

 Create a new Repl

 Online Python-3 Compiler (Interpreter)

 Compile Python 3 Online

 Your Python Trinket

Keywords
A keyword is a reserved word in a programming language that performs a specific purpose. In
your first Python example, you briefly encountered the keywords for and in. Note that keywords
will often appear in bold in this course.

In the next few weeks, you will also learn the following keywords:

Values: True, False, None Conditions: if, elif, else Logical operators: and, or, not Loops: for,
in, while, break, continue Functions: def, return

You don't need to learn this whole list now. We'll dive into each keyword as we encounter them.
There are additional reserved keywords in Python. If you would like to read about them, please
visit the linked “Python Keywords” article in the Resources section at the end of this study
guide.

Arithmetic operators
Python can calculate numbers using common mathematical operators, along with some special
operators, too:

x+y Addition + operator returns the sum of x plus y x - y Subtraction - operator


returns the difference of x minus y x * y Multiplication * operator returns the product of x
times y x / y Division / operator returns the quotient of x divided by y x**e
Exponent ** operator returns the result of raising x to the power of e x**2 Square
expression returns x squared x**3 Cube expression returns x cubed x**(1/2) Square
root (½) or (0.5) fractional exponent operator returns the square root of x x // y Floor
division operator returns the integer part of the integer division of x by y x % y Modulo
operator returns the remainder part of the integer division of x by y
Order of operations
The order of operations are to be calculated from left to right in the following order:

1. Parentheses ( ), { }, [ ]

2. Exponents xe (x**e)

3. Multiplication * and Division /

4. Addition + and Subtraction -

You might find the PEMDAS mnemonic device to be helpful in remembering the order.

Resources for more information


For more information about the concepts covered in this reading, please visit:

 Built-in Functions - Lists and summarizes Python’s built-in functions.

 Python Keywords - Lists Python’s reserved keywords and a brief description of what each
keyword does.

 Different Arithmetic operators in Python - Provides more examples of the proper syntax for
using arithmetic operators in Python.

For additional Python practice, the following links will take you to several popular online
interpreters and codepads:

 Welcome to Python

 Online Python Interpreter

 Create a new Repl

 Online Python-3 Compiler (Interpreter)

 Compile Python 3 Online

 Your Python Trinket

Review: Use the command-line


The command-line is used to tell your computer what to do. You can use it to access servers, move
files, change directories, and write scripts. In this reading, you will learn how to write Python scripts
at the command-line along with the Python GUI IDLE. We will also cover the different ways you can
access the command-line based on your operating system.
Using the command line on MacOS
Using the spotlight search, type in “terminal.” Select the terminal application. You should see your
username followed by the $ sign. MacOS comes with Python 2.7 pre-installed. You can install
Python 3 from python.org. Just remember, this means that you will have 2 versions of Python
installed on your Mac, and you will need to pay special attention to your paths.

To check which version of Python you have installed on your Mac, use the following command.

python --version

To check for Python3, use the following command.

python3 --version

Using the command line on Windows OS


In Windows, open the start menu. In the search box type cmd. Right-click on cmd and select Run as
administrator. This will open up the command-line. Windows OS does not come with Python
installed. Visit the official Python download page for Windows. Select the Windows installer (64-bit)
or (32-bit). After the installer is downloaded, double–click the file. Select Install launcher for all users.
Follow the prompts during installation. Make sure to select the Add python.exe PATH checkbox. This
will allow you to launch Python from the command line. Once installation is complete, you can check
for Python from the command line.

To check for Python, use the following command. The version of Python you installed will appear.

python --version

Using the command line on Linux OS


Access the Linux terminal using Ctrl + Alt + T. This will allow you to check for Python. Type python.
Python comes preinstalled on most Linux systems. If the command is not found, you can install
Python by writing sudo apt install python3.

You can begin writing Python code from the terminal. Simply type python to use the interactive
mode. You can also write Python scripts using Linux with IDLE which we will cover next.

Using IDLE
Python IDLE is included with Python installations on Windows and MacOS. You can download IDLE
using your package manager on Linux. Python IDLE is an interactive interpreter or file editor that
allows you to easily write Python scripts and programs. IDLE provides syntax highlighting, code
completion, and automatic indentation.

Double click on the IDLE icon to open it on your computer. This will open a blank Python interpreter
window. You can begin writing code right away.

You can also open a new file. Go to File → Open → New File from the menu bar. Here you can write
a Python file. Once you have completed writing your Python code in the file, go to File → Save As.
Give your Python file a name. Hit Save. To run the Python code in the file you saved click Run →
Run Module from the menu.
Sum.py File

Sum.py Output

Key takeaways
Whichever operating system you are using, you will be able to run Python from the command-line.
Using a text editor like IDLE and running python from the command-line is best for executing and
debugging individual scripts or .py files.

Resources for more information


Here is a list of additional resources for writing and running Python on your local machine.

 A guide to using terminal (command-line) on Mac, Windows, and Linux operating systems.

 IDLE documentation and instructions

 Python Scripts vs. Jupyter Notebooks

Use VS Code
VS code is an open source code editor that includes developer tooling. It is similar to Jupyter
Notebooks and Colab, but it includes more features. VS code provides built-in support with
Intellisense code completion, an interactive debugger, and other build and scripting tools. VS code
has a simple design that is easy to use. Its intuitive features make it a great choice for coding in
Python!

Using VS Code with Python


To use VS code for Python, you will need to have Python3, VS Code, and the VS Code Python
extension installed. Make sure that you have Python3 installed on your computer by typing the
following command in the terminal on your computer.

Linux/macOS: open a Terminal Window and type the following command:

python3 --version

Windows: open a command prompt and run the following command:

py -3 –version

If Python3 is installed the output should look like this:

$python3 -- version

Python 3.11.3

If it is not installed the output will look like this:

$python3 -- version
command not found: python

Download VS Code and install the Python extension


You can download VS code here. You can use VS code on Windows, Mac, and Linux operating
systems. Download the version that is compatible with your operating system. Follow the download
prompts. Once the download and installation is complete you will be able to open VS Code and
begin using it.

Next, you will install the Python extension. You can do this by visiting the VS Code Marketplace.
Follow the download instructions there. You can check to make sure the Python extension was
added successfully by clicking on this icon in VS Code.

Note: You cannot use VS Code Marketplace to install the Python extension on MacOS.

For MacOS, open the command palette in VS code. You can do this by hitting Cmd+Shift+P. Type
‘shell command’. Find the Shell Command: Install ‘code’ command in PATH.

Once this is completed you can begin writing, running, and debugging Python code in VS Code!

Pro tip: To try VS Code without downloading or installation click here.

Create a Python File


To create a Python file in VS Code go to File → New File… → Python File. A new workspace will
appear, and you can begin writing your Python code. Let’s test it out with a simple statement. Type
the following statement into the new workspace.

print(“Hello World!”)

Next, click on the Run and Debug icon in the left hand toolbar.

Then, click Run and Debug here:

You will be prompted to name and save your file. Give your Python file a name and click save.

Your code will run and you will see its output here.

Now you know the basics of VS Code and how to use it!

Key takeaways
VS Code is an extremely robust source code editor. It uses Intellisense technology which provides
syntax highlighting and autocomplete for coding. VS code allows you to debug right in the editor with
its interactive console. Overall, VS code is extremely interactive and customizable. There is also a
large library of extensions that are easily integrated!

Resources for more information


Here are some resources on what VS Code has to offer!

 This resource provides an overview of VS Code.

 This resource provides more information on using Python with VS Code and also includes a tutorial
you can follow along with.

 This is the extension library for VS Code.

More on IDEs and code editors


There are lots of code editors and IDEs out there. In this reading, we will cover some other popular
IDEs. Feel free to try them out and see which ones you like best!

PyCharm
PyCharm is a very popular IDE for Python development. It is an open source IDE that offers many
great features to help you write better code faster. It is an intelligent code editor that has useful
features, including code completion, error detection, and on-the-fly code fixes. PyCharm also allows
you to navigate easily through your code with code folding, code search, and code structure
diagrams. The built-in debugger provides breakpoints, step-by-step execution, and variable
inspection which allows you to find and fix bugs very quickly. You can test your code within the IDE
which allows you to ensure your code is reliable and error free. Finally, PyCharm also offers a wide
range of plug-ins created by its community of developers which has expanded its functionality.

Overall, PyCharm is a great choice when it comes to an IDE. It is great for beginners because it is
easy to use and has a large community of users which means there are tons of tutorials and
resources available online. PyCharm is also highly customizable. It is a popular IDE that many
developers use and love!

PyDev
PyDev is an open source IDE for Python Development that is based on Eclipse. PyDev includes an
intelligent code editor, code navigation, debugging, testing, and refactoring. Its refactoring engine
can help you improve the structure and readability of your code which makes maintenance and
debugging easier. PyDev is also fully integrated with Eclipse which means you can use all of
Eclipse’s features like project explorer, the perspective system, and its built-in debugger.

PyDev is a great IDE for developers at any stage! It's free to use, compatible with many versions of
Python, and its plugins make it extensible. PyDev has a large community of users and developers
which means there are lots of tutorials, resources, and forums online.

Atom
Atom is an open source text editor developed by GitHub. It is a highly customizable editor with
thousands of plugins available. Atom includes syntax highlighting, code completion, and debugging.
Atom is lightweight, very easy to install, and can be used on any operating system.
Atom is a popular choice for Python developers. It is free to use, has a large community of users,
and has an intuitive interface!

Key Takeaways
PyCharm, PyDev, and Atom are popular tools used for writing Python code. To try them out, you can
download and install them here!

 For more information on PyCharm and to download it, click here.

 For more information on PyDev and to download it, click here.

 For more information on Atom and to download it, click here.

Resources for more information


Now, we have covered different coding tools and how to use them. Code editors and IDEs are
essential for writing efficient Python code. Every programmer has their favorite tools, and you can
find yours by comparing features and testing them out.

Here are some resources you might find useful as you dive deeper into Python programming.

 This blog includes the latest news and updates on Jupyter Lab and Jupyter Notebooks.

 This resource includes tons of tips and tricks for using VS Code.

 This reading includes more information on some of the features Colab has to offer, including GitHub
integration, keyboard shortcuts, and more!

 This resource has tons of information on IDLE. It covers everything from working with files to
debugging and more!

You might also like