0% found this document useful (0 votes)
15 views

Learning to Code with Python Reference Guide

Uploaded by

jiwetech1
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)
15 views

Learning to Code with Python Reference Guide

Uploaded by

jiwetech1
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/ 4

Learning to Code with Python

Module 1 Getting started


Real world examples of projects that use Python
• Industrial Light and Magic uses Python to help with image processing and lighting special effects

• ForecastWatch.com uses Python to help with weather forecasts

• DevNet uses Python to aggregate news feeds

• A student in the UK made a desktop dinosaur roar every time it was mentioned on twitter with
Python and Raspberry Pi

How to install the tools to code in Python


The installation steps are explained at the Python Tools for Visual Studio website

1. Install Visual Studio 2013 for desktop (free)

2. Install Visual Studio 2013 Update 2 so you have the latest features

3. Install Python Tools for Visual Studio

4. Install the Python 3.4 interpreter

How do you create a Hello World project to test your installation?


Start Visual Studio

1. From the top menu select File | New | Project


2. Select Installed | Templates | Python
3. Select the project type: Python Application
4. Type in a name for your project: HelloWorld
5. Select OK
After you select OK you will see the code editor window appear on the screen with a single line of code

That line of code is Python code that will print the words ‘Hello World’ on the screen

To run the program you can either use the function key F5, or you can select Debug| Start Debugging
from the menu, or you can press the Start Debugging button in the toolbar.
When you run the program, if you see the following output, then you have successfully installed Visual
Studio and the Python Tools for Visual Studio, and you are ready to code!

NOTE: If you got an error message saying something about not being able to find the interpreter, then it
is possible Visual Studio can’t find it. You can find instructions on how to tell Visual Studio how to locate
the interpreter manually here. Just scroll down to the part of the page that says “Hey, I already have an
interpreter on my machine, but PTVS doesn’t seem to know about it”. Follow the instructions then try to
run your program again.

To exit the program, you can press any key to continue as indicated in the displayed window, or you can
use the function key SHIFT+F5, or you can select Debug | Stop Debugging from the menu, or you can
press the Stop Debugging button in the toolbar.

You are now a programmer!


Module 2 Displaying Text
Print
Text is displayed on the screen using the print statement. The string to be displayed can be enclosed in
single or double quotes.

print("Hickory Dickory Dock! The mouse ran up the clock")

print('Hickory Dickory Dock! The mouse ran up the clock')

Displaying Text over multiple lines


You can use multiple print statements

print('Hickory Dickory Dock!')

print('The mouse ran up the clock')

You can use triple quotes

print('''Hickory Dickory Dock!

The mouse ran up the clock''')

You can use special characters to indicate a new line

print('Hickory Dickory Dock!\nThe mouse ran up the clock')

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy