UW CSE 190p Section 6/21, Summer 2012 Dun-Yu Hsiao.

Slides:



Advertisements
Similar presentations
Linux commands exercise 1. What do you need, if you try to these at home? You need to download and install Ubuntu Linux from the Internet – DVD is need.
Advertisements

Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
Linux & Shell Scripting Small Group Lecture 4 How to Learn to Code Workshop group/ Erin.
Prof. R. Willingale Department of Physics and Astronomy 2nd Year C+R 2 nd Year C and R Workshop Part of module PA2930 – 2.5 credits Venue: Computer terminal.
Introduction to Linux and Shell Scripting Jacob Chan.
Introduction to Python and programming Michael Ernst UW CSE 190p Summer 2012.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Learning basic Unix command IT 325 operating system.
CprE 288 – Quick intro for compiling C in Linux
Unix Command Project Justin Rogers for LS 560 Spring 2015.
The Python interpreter CSE 140 University of Washington Michael Ernst.
Introduction to Programming Workshop 1 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Vim Editor and Unix Command gcc compiler Computer Networks.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu.
ENEE150 – 0202 ANDREW GOFFIN Introduction to ENEE150.
Introduction to Python and programming Ruth Anderson UW CSE 140 Winter
Intro to Programming Environment 1. Today You Will Learn how to connect to a machine remotely with “nomachine NX client” Learn how to create a new “source.
Lecture One. Objective: Provide description of the Command-Line Editor of Linux operating system. Enable students to understand the practical side of.
Linux and Java Basics. What is Linux? Operating system by Linus Torvalds that was a clone of Unix (thus Linux) Free and open source – this is the reason.
IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python.
Lab 3 + Using the Terminal 1. "Under Linux there are GUIs (graphical user interfaces). where you can point and click and drag, and hopefully get work.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python Karsten Hokamp, PhD Genetics TCD, 03/11/2015.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
Practical Kinetics Exercise 0: Getting Started Objectives: 1.Install Python and IPython Notebook 2.print “Hello World!”
Exploring Spyder: An IDE for scientific computing
1 Lecture 7 Introduction to Shell Scripts COP 3353 Introduction to UNIX.
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
UW CSE 140 Section 1/10, Winter Find partners! Group can be 2-4 people. Try to share as much as possible about what you think with your teammates!
Introduction to Unix for FreeSurfer Users
ENEE150 Discussion 01 Section 0101 Adam Wang.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Intro to shell scripting
Intro to shell scripting
Introduction to Python
Discussion 11 Final Project / Git.
CSE 390a Lecture 5 Intro to shell scripting
Introduction to Python and programming
Shell Script Assignment 1.
CSE 374 Programming Concepts & Tools
Intro to shell scripting
INTRODUCTION TO UNIX: The Shell Command Interface
Intro to UNIX System and Homework 1
Introduction to Python and programming
Introduction to Python and programming
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Introduction to Python and programming
Intro to shell scripting
Intro to shell scripting
Intro to shell scripting
CSE 303 Concepts and Tools for Software Development
Video Notes.
Input and Output Python3 Beginner #3.
CSCE 206 Lab Structured Programming in C
The Python interpreter
Introduction to Python and programming
UW CSE 190p Section 6/28, Summer 2012 Dun-Yu Hsiao.
ME 123 Computer Applications I Lecture 7: Basic Functions 3/20/03
Presentation transcript:

UW CSE 190p Section 6/21, Summer 2012 Dun-Yu Hsiao

Now it’s time to team up and code! Find a partner and make sure that you have at least one laptop. Try to share what you think with your teammate!

Today’s material will also be covered in the following lectures with more details, so don’t worry if you feel confused. When in doubt, you can always stop me and ask!

Continue from Michael’s lecture…

A program is a recipe

What is a program? A program is a sequence of instructions The computer executes one after the other, as if they had been typed to the interpreter x = 1 y = 2 x + y print x + y print "The sum of", x, "and", y, "is", x+y

IDLE Now try to change x = 3, y = 4 and make print the result out again. Any better way rather than type everything all over again? – Use the editor – Be sure to save as.py to have code highlights

Exercise: Print a table Create a table using print about the simple info of your team. The required variable fields are: First name, Last name, Month of birth in number, and Favorite color. Your code should start with: first_name = “Bill” last_name = “Howe”... Example output: "Bill Howe, 1, likes green" "Dun-Yu Hsiao, 5, likes red"

Exercise: Print a table Careful about the conversion between number and string Use str(some number)

Exercise: Convert temperatures Testing your program Making a temperature conversion chart – Chart the conversion of 5F, 32F, 104F, 212F, 293F – Print out example: 5F -15.0C... – (Tedious, isn’t it?) You can create a Python program!

Loops: basics Use loop to reduce code repetition! For loop: for iterating_var in sequence: statements(s) for x in [ 10, 2, 43]: print( x ) List list1 = ["a", "b", "c", "d"] list2 = [1, 2, 3, 4, 5 ] list3 = ['phys', 'chem', 1997, 2000]

Exercise: Convert temperatures Now try it using one for loop! Much more concise!

Exercise: Create a log table using loop Numbers: 1, 2, 4, 8, 10, 20, 40, 80, 100, 200, 400, 800, 1000 Import - To not reinvent the wheel! - Use the console to check usage quickly!

Careful! Don’t forget colon Careful about the indentation

Start Using Command Lines Command Prompt in Windows Terminal in Mac/Linux

Command Line Basics Show current directory/folder – pwd (on unix, linux, osx) – echo %cd% (on windows) List contents in the current directory/folder – ls (on unix, linux, osx) – dir (mostly only on windows) / on unix, linux, osx \ on windows

Change directory – cd Use “tab” to loop through path! Make directory – mkdir (on unix, linux, osx) – md (on windows)

Exercise Go to your desktop directory In Desktop, create directories in this structure: – Desktop test_dir1 – test_sub_dir1-1 – Test_sub_dir1-2 test_dir2 – Test_sub_dir2-1

Now go into test_sub_dir_1-2 – Copy and save the commands you used in the report. Now go into test_sub_dir_2-1 – Copy and save the commands you used in the report.

Invoking Python from the command line python myprogram.py python myprogram.py argument1 argument2 The operating system command shell is not the same as the Python interpreter

Today’s takeaway IDLE Print Loop List Import

Questions?