Science One CS : Getting Started

Similar documents
Python Programming Exercises 1

CS 1110, LAB 1: EXPRESSIONS AND ASSIGNMENTS First Name: Last Name: NetID:

Using IDLE for

Lab 1: Setup 12:00 PM, Sep 10, 2017

Coding in C at Home. Part 2 Computational Physics. April 21, 2016

CMSC 201 Spring 2017 Lab 01 Hello World

Getting Started With NetLogo

CMSC 201 Spring 2018 Lab 01 Hello World

Getting started with Python

Semester 2, 2018: Lab 1

Getting Started with Command Prompts

1 Installation (briefly)

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 1 / 9

Setting up my Dev Environment ECS 030

Introduction to REXX Programming Language

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

What you get When you install Python for your computer, you get a number of features:

Setting up Python 3.5, numpy, and matplotlib on your Macintosh or Linux computer

Unit 10. Linux Operating System

Instructions. First, download the file

Laboratory Exercise #0

WHAT IS MATLAB?... 1 STARTING MATLAB & USING THE COMMAND LINE... 1 BASIC ARITHMETIC OPERATIONS... 5 ORDER OF OPERATIONS... 7

Episode 1 Using the Interpreter

Computers and Computation. The Modern Computer. The Operating System. The Operating System

The Command Shell. Fundamentals of Computer Science

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

Lab: Supplying Inputs to Programs

Chapter 4. Unix Tutorial. Unix Shell

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

Command Line Navigation and Compiling

Using the Zoo Workstations

Getting Started With NetLogo

Website Development Komodo Editor and HTML Intro

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

Unit 13. Linux Operating System Debugging Programs

CS1 Lecture 4 Jan. 24, 2018

eggplant v11.0 Mac OS X EggPlant: Getting Started

CheckBook Pro 2 Help

Lab 7c: Rainfall patterns and drainage density

LAB #5 Intro to Linux and Python on ENGR

If your Mac keeps asking for the login keychain password

Summer Assignment for AP Computer Science. Room 302

UNIT 9 Introduction to Linux and Ubuntu

Where Did My Files Go? How to find your files using Windows 10

Introduction to Programming with Python 3, Ami Gates. Chapter 1: Creating a Programming Environment

Handbook: Carbonite Safe

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

A computer program is a set of instructions that causes a computer to perform some kind of action. It isn t the physical parts of a computer like the

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

ENCM 339 Fall 2017: Cygwin Setup Help

Getting Started with Python and the PyCharm IDE

A Brief Introduction to the Linux Shell for Data Science

CONVERSION TRACKING PIXEL GUIDE

If you are on a Mac/Linux box, some commands will differ, but many will be the same.

Human-Computer Interaction Design

Introduction to Linux Spring 2014, Section 02, Lecture 3 Jason Tang

Bioinformatics? Reads, assembly, annotation, comparative genomics and a bit of phylogeny.

Chapter Two Bonus Lesson: JavaDoc

One of the hardest things you have to do is to keep track of three kinds of commands when writing and running computer programs. Those commands are:

CME 193: Introduction to Scientific Python Lecture 1: Introduction

CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) First Name: Last Name: NetID:

Intermediate Programming, Spring Misha Kazhdan

PYTHON YEAR 10 RESOURCE. Practical 01: Printing to the Shell KS3. Integrated Development Environment

Your departmental website

Introduction to Python. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas

Project 1: Implementing a Shell

Linux Bootcamp Fall 2015

An Introduction to Python

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi and Cyrill Stachniss

NAVIGATING UNIX. Other useful commands, with more extensive documentation, are

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

Data Reduction Helpdesk First Responder Guidelines

Step 1: Adding Darwin to your computer

Getting Started with Python

CSC116: Introduction to Computing - Java

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

last time in cs recitations. computer commands. today s topics.

STATS 507 Data Analysis in Python. Lecture 0: Introduction and Administrivia

EXCEL BASICS: MICROSOFT OFFICE 2007

1. Open VirtualBox and start your linux VM. Boot the machine and log in with the user account you created in Lab #1. Open the Terminal application.

Conda Documentation. Release latest

Welcome to Bootcamp2015 s documentation!

Physics 306 Computing Lab 1: Hello, World!

your Apple warranty; see There are two main failure modes for a mirrored RAID 1 set:

Arduino IDE Friday, 26 October 2018

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

CPSC 213 Labs Cheat-Manual

Flash Video Encoder CS3 Fetch Microsoft Office 2004 (Excel, imovie. Powerpoint, Word, Entourage) itunes

Tutorial 1: Unix Basics

Laboratory 1: Eclipse and Karel the Robot

Matlab = Matrix Laboratory. It is designed to be great at handling matrices.

#Uncomment the second line to enable any form of FTP write command. #write_enable=yes

Operating System Interaction via bash

tutorial : modeling synaptic plasticity

Remote Access to Matlab at Mason. CDS-130: Computing for Scientists. Spring Jie Zhang

Lab 1 Introduction to UNIX and C

Transcription:

Science One CS 2018-2019: Getting Started Note: if you are having trouble with any of the steps here, do not panic! Ask on Piazza! We will resolve them this Friday when we meet from 10am-noon. You can also post questions on Piazza. Note: if you are using an operating system other than Mac OS or Windows (e.g., Ubuntu), the process will be similar but slightly different. If you get stuck, we will sort it out on Friday. 1. Install Python with Anaconda o Go to http://continuum.io/downloads o Select your operating system, download python 3.6 (not python 2.7), follow on-screen instructions using all default/recommended options (but add anaconda to the path if possible) o If you re having difficulties on Windows take a look at the youtube video Install Python (Anaconda) on Windows + Setting Python and Conda Path (2017) 2. Find your terminal For Mac OS: o Click on the search icon in the top right corner o Type in terminal and press enter o If you want, right-click on the Terminal icon in your dock and select Options -> Keep in Dock (you will use this terminal throughout the course) For Windows o There are many ways to do this. The Windows terminal is called Command Prompt. You can Google how to open the command prompt for your version of Windows. I have Windows 8 and I usually click on the Windows logo at the bottom-left, then click on the magnifying glass for searching, and then just type command prompt and press enter.

3. Test out Anaconda In your terminal, type python and press enter. You should see something containing the word Anaconda. This is what I see: Python 3.6.1 Anaconda 4.4.0 (x86_64) (default, May 11 2017, 13:04:09) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. 4. Make Sure Make sure packages are installed at the python prompt (which looks like > >>), o type import numpy and press enter. If things are installed properly, nothing will happen. If there is a problem, you will get an error message. o Type import scipy and press enter. o Type import matplotlib and press enter. o Type 1+1 and press enter (you should see the result as 2 ) 5. Exit python To get out of Python, type exit() and press enter (or just press control-d) 6. Download and run Sublime Text: Sublime Text is a text editor that you ll use to write your programs. Programs are just text files with special characters that the computer recognizes. Sublime Text is like Microsoft Word, but doesn t add any funny characters or formatting that will wreck your program. Actually, you could use any text editor to make your programs, but Sublime Text has pretty colours. Go to https://www.sublimetext.com, download, and install the program. Open the program and look around. Sublime Text has an unlimited use trial version. The idea is that you learn to love it when you re poor, then when you get your fancy programming job you can buy it. If Sublime Text doesn t work for some reason there is text editor called spyder, which is bundled with Anaconda so it should be installed already. Type spyder & in the terminal and press enter. Replace Sublime Text with spyder in the following instructions.

7. In a desired location, create a folder on your computer to save your programs. example: /home/yourname/documents/scienceonecs 8. Inside the folder you just made, make another folder named HelloWorld I recommend creating a folder for each homework assignment (with the appropriate name of the assignment) 9. In Sublime Text, make a new file (File -> New File...) and save it in the HelloWorld folder you just made, with the name HelloWorld.py. This will contain the first program! We will only use Atom as a text editor in this course, but it can do a lot more. STOP HERE! We will do the rest together in class on Friday.

The First Program - Hello World 1. Comments - Some lines in a.py file are actual code (that will run) and other lines are comments they do not run and they do not change what the program does. These comments are for programmers to write notes to themselves and to others who read the code. It is great programming practice to use comments to explain what your code does and help other people that may want to use and modify your code. In addition to this way of using comments, in this course you will use a comment at the beginning of each of your.py files to identify them as your own. comments are enclosed in three quotation marks (") on each side """ This is a comment """ comments that do not extend past one line can use the syntax # This is a one line comment your HelloWorld.py already has a multi-line comment (the """ type) at the beginning. Modify this comment following the example below: """ Author: Jen Jones UBC CWL: 12345678 Course: Science One Computer Science Assignment: Hello, World! Date: 8 September 2017 Description: Prints "Hello, World!" Input: none Output: "Hello, World!" Example running command: python HelloWorld.py """ 2. The actual code type the following line in your HelloWorld.py, after the comment: print ("Hello, World!" ) save the file (Command + S). It is great programming practice to save your current file frequently (every few minutes) while working on your program

3. Run your code (there are several ways to do it but this is the recommended way for this course): open another terminal window (the first one you opened is now busy running spyder, don t worry about it) navigate to your HelloWorld folder in the terminal using the three terminal instructions below type python HelloWorld.py ( and press Enter). You should see Hello, World! appear on the following line. You are done! Three Useful Terminal Commands & How to Run Your Programs You can use the terminal to navigate through your computer s file system and run various applications. Here are some useful commands to navigate to a desired folder: pwd (on Mac) shows the path of your current directory (i.e. tells you where you are) o on Windows, the terminal prompt contains the path of your current directory ls (onmac)/ dir( onwindows) shows what is in the current directory. cd <directoryorpath> (on both Mac and Windows) change directory to the specified directory (NOTE: the use of the greater than and less than signs are meant to indicate that you need to type in whatever directory or path you want to go to. you should not literally type in these symbols into the terminal) o cd.. goes up one level, to the parent folder o extra tip: TAB does autocomplete for file names (start typing the name of a file/folder and press TAB before you finish typing) o For Windows only: to switch to another drive, for example to get to D: you need to type just D: and press enter rather than typing cd D: o Note: on Mac OS in the terminal, you can use the symbol ~ as shorthand for your home directory. So for example cd ~/Desktop will probably get you to your desktop. This is an absolute path rather than a relative path it points directly to your home directory regardless of what directory you are currently in.

Note: if your directory names have spaces in them, you need to precede each space character with a backslash ( \ ) character. if you are using TAB to autocomplete it will do this for you. In general, it will be easier if your files and directory names don t have spaces in them. Once you are in the desired directory (folder), you can run things in that folder. You must navigate to the folder of your assignment (where your.py files are) to run.py files. Once you are there, you type: python <program name>.py <command line arguments> (again, see note above about the < and > symbols). You can do a lot more with a terminal, but this is enough for now. For more commands, here are some references: Mac OS X: http://ss64.com/osx/ (almost the same as Linux terminal commands) Windows: http://ss64.com/nt/ Congratulations!