# Python Programming, 1/e 1

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 "\$% " " " ) " * -. ) / 0 ( + 34 average4.py A program to average a set of numbers Illustrates sentinel loop using empty string as sentinel def main(): sum = 0.0 count = 0 xstr = raw_input("enter a number (<Enter> to quit) >> ") while xstr = "": x = eval(xstr) sum = sum + x count = count + 1 xstr = raw_input("enter a number (<Enter> to quit) >> ") print "\nthe average of the numbers is", sum / count main() 1 " * ) 5 Python Programming, 1/e 1

2 " *89 :+5;( 5 5 " "0 )) 7 4 " ( x x ) s = i n 1 < x xi ")* ( x x ) i => ; " *=> +5; ( "54 " ( 6.8 ) + ( 6.8 4) + ( 6.8 6) + ( 6.8 9) + ( ) = s = = 37.4 = ? * \$3 30.A Python Programming, 1/e

3 * :* B? ( C 8 * 9 * n 1 i i= 0 ( s * s. *0 sum = 0 for i in range(n): sum = sum + s[i] *0 + * * \$s% ) \$ s[i]% )9 " 0 * 1 5 E*FKE*F E*FJE8)F E*FGH \$E*F% E*FGH EFE*F E)FE*F - I ) -\$% 0 3 " * >>> lst = [1,,3,4] >>> 3 in lst True 7 4 Python Programming, 1/e 3

4 " ) 0 sum = 0 for x in s: sum = sum + x L0 >>> lst = [1,,3,4] >>> lst[3] 4 >>> lst[3] = "Hello >>> lst [1,, 3, Hello] >>> lst[] = 7 >>> lst [1,, 7, Hello] " 1? 9 zeroes = [0] * 50 ;? nums = [] x = input(enter a number: ) while x >= 0: nums.append(x) x = input(enter a number: ) <nums 0 - EF\$)% EF\$% EF\$% EF)\$)% EF\$)% EF\$)% EF\$)% EF\$% - ) \$% I I)) )) I) ) >>> lst = [3, 1, 4, 1, 5, 9] >>> lst.append() >>> lst [3, 1, 4, 1, 5, 9, ] >>> lst.sort() >>> lst [1, 1,, 3, 4, 5, 9] >>> lst.reverse() >>> lst [9, 5, 4, 3,, 1, 1] >>> lst.index(4) >>> lst.insert(4, "Hello") >>> lst [9, 5, 4, 3, Hello,, 1, 1] >>> lst.count(1)s >>> lst.remove(1) >>> lst [9, 5, 4, 3, Hello,, 1] >>> lst.pop(3) 3 >>> lst [9, 5, 4, Hello,, 1] ( del + Python Programming, 1/e 4

5 >>> mylist=[34, 6, 0, 10] >>> del mylist[1] >>> mylist [34, 0, 10] >>> del mylist[1:3] >>> mylist [34] del 38 * ) M 1 5 * getnumbers.3 " def getnumbers(): nums = [] start with an empty list sentinel loop to get numbers xstr = raw_input("enter a number (<Enter> to quit) >> ") while xstr = "": x = eval(xstr) nums.append(x) add this value to the list xstr = raw_input("enter a number (<Enter> to quit) >> ") return nums L data = getnumbers() ; (? Python Programming, 1/e 5

6 N def mean(nums): sum = 0.0 for num in nums: sum = sum + num return sum / len(nums) ")0 0 stdeva stdeva ( ( I stdev 3 stdev def stdev(nums, xbar): sumevsq = 0.0 for num in nums: dev = xbar - num sumevsq = sumevsq + dev * dev return sqrt(sumevsq/(len(nums)-1)) " sumevsq * (( ( : 8 9 B B (1 (5 Python Programming, 1/e 6

7 def median(nums): nums.sort() size = len(nums) midpos = size / if size % == 0: median = (nums[midpos] + nums[midpos-1]) /.0 else: median = nums[midpos] return def main(): print This program computes mean, median and standard deviation. data = getnumbers() xbar = mean(data) std = stdev(data, xbar) med = median(data) print \nthe mean is, xbar print The standard deviation is, std print The median is, med (7 (4 3 if name == main : main() )30 0. )0 (; +? / / Sutdent Get the name of the input file from the user Read student information into a list Sort the list by GPA Get the name of the output file from the user Write the student information from the list into a file / + + Python Programming, 1/e 7

8 3 " def readstudents(filename): infile = open(filename, r) students = [] for line in infile: students.append(makestudent(line)) infile.close() return students.3 makestudentgpa 3 3 0, * def writestudents(students, filename): students is a list of Student objects outfile = open(filename, w) for s in students: outfile.write("%s\t%f\t%f\n" % (s.getname(),s.gethours(),s.getqpoints())) outfile.close() +( ++ L readstudents writestudents 0 / sort < A 8cmp cmp * >>> cmp(1-1 >>> cmp(,1) 1 >>> cmp("a","b") -1 >>> cmp(1,1.0) 0 >>> cmp("a",5) 1 :3 0= > "0 0 sort. cmp8 0 sort "/ Python Programming, 1/e 8

9 .8cmp def cmpgpa(s1, s): return cmp(s1.gpa(), s.gpa(). \$cmpgpa% data.sort(cmpgpa) data.sort(cmpgpa) N3()3 cmpgpa "3 cmpgpa cmpgpa +; 1? O O / 0 \$% B\$PP% BGH \$0\$%% \$% \$% UUUUBBPUUUUP B\$PP% \$% \$QRSRSRSQR \$ N\$% <\$% T\$%%% \$% /\$% \$ \$% \$%% \$% Q" /Q BU\$Q, Q% B\$% \$/% BU\$Q, Q% \$% Q"Q dieview 00 00pip1 pippip3c 1 1. A 0 self.pip1 = self. makepip(cx, cy) makepip ieview pips = [] pips.append(self. makepip(cx-offset,cy-offset) pips.append(self. makepip(cx-offset,cy) self.pips = pips 1( 1+ Python Programming, 1/e 9

10 self.pips = [self. makepip(cx-offset,cy-offset), self. makepip(cx-offset,cy), self. makepip(cx+offset,cy+offset) ] 0 VH "0 0 for pip in self.pips: pip.setfill(self.background) self.pip1.setfill(self.foreground) self.pip4.setfill(self.foreground) self.pip7.setfill(self.foreground) self.pips[0].setfill(self.foreground) self.pips[3].setfill(self.foreground) self.pips[6].setfill(self.foreground) <3 for i in [0,3,6]: self.pips[i].setfill(self.foreground).0 Loop through pips and turn them all off etermine the list of pip indexes to turn on Loop through the list of indexes - turn on those pips for pip in self.pips: self.pip.setfill(self.background) if value == 1: on = [3] elif value == : on = [0,6] elif value == 3: on = [0,3,6] elif value == 4: on = [0,,4,6] elif value == 5: on = [0,,3,4,6] else: on = [0,1,,3,4,5,6] for i in on: " value.08. ) :)( [0,3,6] ( 1; 5? Python Programming, 1/e 10

11 <38 ontable = [ [], [3], [,4], [,3,4], [0,,4,6], [0,,3,4,6], [0,1,,4,5,6] ] for pip in self.pips: self.pip.setfill(self.background) on = ontable[value] for i in on: self.pips[i].setfill(self.foreground) ontable = [ [], [3], [,4], [,3,4], [0,,4,6], [0,,3,4,6], [0,1,,4,5,6] ] for pip in self.pips: self.pip.setfill(self.background) on = ontable[value] for i in on: self.pips[i].setfill(self.foreground) "VGH3? 3 "ontable dieview0 5 5 dieview.py A widget for displaying the value of a die. This version uses lists to simplify keeping track of pips. class ieview: """ ieview is a widget that displays a graphical representation of a standard six-sided die.""" def init (self, win, center, size): """Create a view of a die, e.g.: d1 = Gie(myWin, Point(40,50), 0) creates a die centered at (40,50) having sides of length 0.""" first define some standard values self.win = win self.background = "white" color of die face self.foreground = "black" color of the pips self.psize = 0.1 * size radius of each pip hsize = size /.0 half of size offset = 0.6 * hsize distance from center to outer pips create a square for the face cx, cy = center.getx(), center.gety() p1 = Point(cx-hsize, cy-hsize) p = Point(cx+hsize, cy+hsize) rect = Rectangle(p1,p) rect.draw(win) rect.setfill(self.background) Create 7 circles for standard pip locations self.pips = [ self. makepip(cx-offset, cy-offset), self. makepip(cx-offset, cy), self. makepip(cx-offset, cy+offset), self. makepip(cx, cy), self. makepip(cx+offset, cy-offset), self. makepip(cx+offset, cy), self. makepip(cx+offset, cy+offset) ] Create a table for which pips are on for each value self.ontable = [ [], [3], [,4], [,3,4], [0,,4,6], [0,,3,4,6], [0,1,,4,5,6] ] self.setvalue(1) def makepip(self, x, y): """Internal helper method to draw a pip at (x,y)""" pip = Circle(Point(x,y), self.psize) pip.setfill(self.background) pip.setoutline(self.background) pip.draw(self.win) return pip def setvalue(self, value): """ Set this die to display value.""" Turn all the pips off for pip in self.pips: pip.setfill(self.background) Turn the appropriate pips back on for i in self.ontable[value]: self.pips[i].setfill(self.foreground) ). ) = > 5( 5+ "dieview ontable. \$ % 3 " \$?8;% \$% :\$K8J% 0 V3 VE83 0 VB Python Programming, 1/e 11

12 .0 B : " def init (self): create the window for the calculator win = GraphWin("calculator") win.setcoords(0,0,6,7) win.setbackground("slategray") self.win = win ) create list of buttons start with all the standard sized buttons bspecs gives center coords and label of buttons bspecs = [(,1,0), (3,1,.), (1,,1), (,, (3,,3), (4,,+), (5,,-), (1,3,4), (,3,5), (3,3,6), (4,3,*), (5,3,/), (1,4,7), (,4,8), (3,4,9), (4,4,<-),(5,4,C)] self.buttons = [] for cx,cy,label in bspecs: self.buttons.append(button(self.win,point(cx,cy),.75,.75,label)) create the larger = button self.buttons.append(button(self.win, Point(4.5,1), 1.75,.75, "=")) activate all buttons for b in self.buttons: b.activate() bspecs 5; 7?, 00V\$%3 VGH3 " * (cx,cy,label)=<next item from bspecs>,bspecs. 0 " 3 cx,cy,label =,1, Python Programming, 1/e 1

13 , bspecs 0 " Button 6 3 ). ) <3 bg = Rectangle(Point(.5,5.5), Point(5.5,6.5)) bg.setfill(white) bg.draw(self.win) text = Text(Point(3,6), "") text.draw(self.win) text.setface("courier") text.setstyle("bold") text.setsize(16) self.display = text 7( 7+ N.3 0 def run(self): Infinite event loop to process button clicks. while True: key = self.getbutton() self.processbutton(key). 0 0 " 0 0 def getbutton(self): Waits for a button to be clicked and returns the label of the button that was clicked. while True: p = self.win.getmouse() for b in self.buttons: if b.clicked(p): return b.getlabel() method exit < 0 for 0 0p ) " 0 key text self.display.settext(text+key) Python Programming, 1/e 13

14 "00 self.display.settext( ) "00 self.display.settext(text[:-1]) "*0) try: result = eval(text) except: result = ERROR self.display.settext(str(result)) 8) 3 ) 3 ERROR 7; 4? N8* 8 N " * 0 ) 4 4 " 008.\$ %0 \$% ( 4+ Python Programming, 1/e 14

15 08 >>> passwd = {"guido":"superprogrammer", "turing":"genius", "bill":"monopoly"} W V3 "0 0 ) >>> passwd["guido"] superprogrammer >>> passwd["bill"] monopoly <dictionary>[<key>] " 0 >>> passwd["bill"] = "bluescreen >>> passwd {turing: genius, bill: bluescreen, guido: superprogrammer} 3 A W 8 8 )\$ % >>> passwd[newuser] = "ImANewbie >>> passwd {turing: genius, bill: bluescreen, newuser: ImANewbie, guido: superprogrammer} 4; ;? Python Programming, 1/e 15

16 08 passwords passwd = {} for line in open(passwords, r): user, pass = string.split(line) passwd[user] = pass ; ; - <dict>.has_key(<key>) <key> in <dict> <dict>.keys() <dict>.values() <dict>.items() <dict>.get(<key>, <default>) del <dict> [<key>] <dict>.clear() - I 0 has_key I0 I I(key, value) 08 keym default ;( >>> passwd.keys() [turing, bill, newuser, guido] >>> passwd.values() [genius, bluescreen, ImANewbie, superprogrammer] >>> passwd.items() [(turing, genius), (bill, bluescreen), (newuser, ImANewbie), (guido, superprogrammer)] >>> passwd.has_key(bill) True >>> fred in passwd False >>> passwd.get(bill, unknown) bluescreen >>> passwd.get(john, unknown) unknown >>> passwd.clear() >>> passwd {} ;+ N 9) " ) \$0 % ;1 ;5 Python Programming, 1/e 16

17 .0 3 counts "w counts[w] = counts[w] + 1 "3" 3 counts 8 )08 KeyError if w is already in counts: add one to the count for w else: set count for w to 1 ;7 ;4 " if counts.has_key(w): counts[w] = counts[w] + 1 else: counts[w] = 1 counts[w] = counts.get(w,0) + 1 w get? w ;;?? "0) *. ) \$0 => => % \$ =>% fname = raw_input("file to analyze: ") read file as one long string text = open(fname, r).read() convert all letters to lower case text = string.lower(text) replace each punctuation character with a space for ch in }~: text = string.replace(text, ch, ) split string at whitespace to form a list of words words = string.split(text) Now we can easily loop through the words to build the counts dictionary?? Python Programming, 1/e 17

18 . counts = {} for w in words: counts[w] = counts.get(w, 0) counts. <A get list of words that appear in document uniquewords = counts.keys() put list of words in alphabetical order uniquewords.sort() print words and associated counts for w in uniquewords: print w, counts[w] " 0?(?+. " 90 ". 08 items items = counts.items() [(foo,5), (bar,7), (spam,376),...] 0\$08 %8? def compareitems((w1, c1), (w, c)): if c1 > c: return -1 elif c1 == c: return cmp(w1, w) else: return 1 def compareitems((w1, c1), (w, c)): if c1 > c: return -1 elif c1 == c: return cmp(w1, w) else: return 1 "0 8-1?7?4 Python Programming, 1/e 18

19 def compareitems((w1, c1), (w, c)): if c1 > c: return -1 elif c1 == c: return cmp(w1, w) else: return 1 *0 3 " def compareitems((w1, c1), (w, c)): if c1 > c: return -1 elif c1 == c: return cmp(w1, w) else: return 1 1 " items.sort(compareitems)?;? " for i in range(n): print "%-10s%5d" % items[i] N 8? : 8 1 N 3 =>GH wordfreq.py Program to analyze the frequency of words in a text file. Illustrates Python dictionaries import string def compareitems((w1,c1), (w,c)): if c1 > c: return -1 elif c1 == c: return cmp(w1, w) else: return 1 def main(): print "This program analyzes word frequency in a file" print "and prints a report on the n most frequent words.\n" get the sequence of words from the file fname = raw_input("file to analyze: ") text = open(fname,r).read() text = string.lower(text) for ch in }~: text = string.replace(text, ch, ) words = string.split(text) construct a dictionary of word counts counts = {} for w in words: counts[w] = counts.get(w,0) + 1 output analysis of n most frequent words. n = input("output analysis of how many words? ") items = counts.items() items.sort(compareitems) for i in range(n): print "%-10s%5d" % items[i] ( Python Programming, 1/e 19

### for while ' while ' for * for <var> in <sequence>: <body> \$ %%" 0 *0

# & for while while # * # & *, /01* for * 2 for in : ,var 0 2, /01* *** 0 *0 *& 4 00 *0* * /01* 4 6, 4 * /01* Input the count of the numbers, n Initialize sum to 0 Loop n times Input

### Lecture 14 Loop Structures and Boolean Algebra

CITS1401 & CITS4406 Problem Solving & Programming Ghulam Mubashar Hassan Lecture 14 Loop Structures and Boolean Algebra (Based on John Zelle s powerpoint lectures) 15 September 2016 Important Announcement

### CS177 MIDTERM 2 PRACTICE EXAM SOLUTION. Name: Student ID:

CS177 MIDTERM 2 PRACTICE EXAM SOLUTION Name: Student ID: This practice exam is due the day of the midterm 2 exam. The solutions will be posted the day before the exam but we encourage you to look at the

### Fall 2016 Bio331: Computational Systems Biology 1 PYTHON2.7 CONCEPTS

Fall 2016 Bio331: Computational Systems Biology 1 PYTHON2.7 CONCEPTS Fall 2016 Bio331: Computational Systems Biology 2 About These Slides These slides serves as a one stop shop for Python concepts we covered

### Lecture 2, Introduction to Python. Python Programming Language

BINF 3360, Introduction to Computational Biology Lecture 2, Introduction to Python Young-Rae Cho Associate Professor Department of Computer Science Baylor University Python Programming Language Script

### Simple, not Simplistic Squeezing the most from CS1. Python! John M. Zelle, Ph.D. Wartburg College

Simple, not Simplistic Squeezing the most from CS1 Python! John M. Zelle, Ph.D. Wartburg College Outline Motivation Introduction to Python Approaches to CS1 Python Resources Conclusions Questions? Background

### Exercise 1: Python Language Basics

Exercise 1: Python Language Basics In this exercise we will cover the basic principles of the Python language. All languages have a standard set of functionality including the ability to comment code,

### Lab 2 - CMPS 1043, Computer Science I Introduction to File Input/Output (I/O) Projects and Solutions (C++)

Lab 2 - CMPS 1043, Computer Science I Introduction to File Input/Output (I/O) Projects and Solutions (C++) (Revised from http://msdn.microsoft.com/en-us/library/bb384842.aspx) * Keep this information to

### Python Lists and Loops

WEEK THREE Python Lists and Loops You ve made it to Week 3, well done! Most programs need to keep track of a list (or collection) of things (e.g. names) at one time or another, and this week we ll show

1. Introduction Python is a high level language that is used in many areas: YouTube, NASA and Google. It is an interpreted language (meaning that mistakes can be spotted very quickly). Guido Van Rossum

### Chapter 2 Writing Simple Programs

Chapter 2 Writing Simple Programs Charles Severance Textbook: Python Programming: An Introduction to Computer Science, John Zelle Software Development Process Figure out the problem - for simple problems

### Python! Background. Simple, not Simplistic Squeezing the most from CS1. Rethinking CS1. Outline. Teaching since 1986

Background Teaching since 1986 Simple, not Simplistic Squeezing the most from CS1 Python! John M. Zelle, Ph.D. Wartburg College CS1 languages: Pascal, C++, Java (also CS0 BASIC) Favorite class but... increasingly

### PYTHON Basics http://hetland.org/writing/instant-hacking.html

CWCS Workshop May 2009 PYTHON Basics http://hetland.org/writing/instant-hacking.html Python is an easy to learn, modern, interpreted, object-oriented programming language. It was designed to be as simple

### Computer Science 217

Computer Science 217 Midterm Exam Fall 2009 October 29, 2009 Name: ID: Instructions: Neatly print your name and ID number in the spaces provided above. Pick the best answer for each multiple choice question.

### Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Sequences: Strings and Lists Python Programming, 2/e 1 Objectives To understand the string data type and how strings are represented in the computer.

### Instructions for carrying out statistical procedures and tests using SPSS

Instructions for carrying out statistical procedures and tests using SPSS These instructions are closely linked to the author s book: Essential Statistics for the Pharmaceutical Sciences John Wiley & Sons

### Introduction to: Computers & Programming: Input and Output (IO)

Introduction to: Computers & Programming: Input and Output (IO) Adam Meyers New York University Summary What is Input and Ouput? What kinds of Input and Output have we covered so far? print (to the console)

### We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

### Chapter 3: Control Structures

Chapter 3: Control Structures 1. Higher order organization of Python instructions In the previous chapters, we have introduced the different types of variables known by Python, as well as the operators

### Introduction to Programming. Oliver Hawkins

Introduction to Programming Oliver Hawkins Introduction to Programming BACKGROUND TO PROGRAMMING LANGUAGES Some languages used for data analysis Python R Julia JavaScript Stata Why Python? Data analysis

### Counting with While Loops

Simple Loops Iteration Often, we will want a piece of code to run multiple times. This is called iteration or looping. A specific piece of code that is run multiple times is called a loop. While Loop The

### Conditional and Looping Construct

Chapter 3 Conditional and Looping Construct After studying this lesson, students will be able to: Understand the concept and usage of selection and iteration statements. Know various types of loops available

### KS3 Programming Workbook INTRODUCTION TO. Name: Class:

KS3 Programming Workbook INTRODUCTION TO Name: Class: Introducing Python Python is a programming language that is easy to learn. It provides a way to write instructions that are simple for a human to understand

### CONCEPT-II. Overview of demo examples

CONCEPT-II CONCEPT-II is a frequency domain method of moment (MoM) code, under development at the Institute of Electromagnetic Theory at the Technische Universität Hamburg-Harburg (www.tet.tuhh.de). Overview

### Lab 3b: Python II - Functions, and Flow Control

Lab 3b: Python II - Functions, and Flow Control 1 Preliminaries Download the Lab03b.py file into your ENGI128 directory from the web site. Setup your robot, right click on th e file, and select edit with

### Python as a First Programming Language

STEMBOPS Justin Stevens and Giselle Serate Page 1 Python as a First Programming Language Author: Justin Stevens Giselle Serate 1 Introduction STEMBOPS Davidson Academy of Nevada University of Nevada, Reno

### Intro to Python. P. TenHoopen - WMLUG. Intro to Python. Slide 1. January 2009

P. TenHoopen - WMLUG Slide 1 What is Python? Python is a cross-platform object-oriented programming language invented by Guido van Rossum. It is an interpreted language but there is support for compiling

### Exercise 4 Learning Python language fundamentals

Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also

### CSCE 110 Programming I Basics of Python: Variables, Expressions, and Input/Output

CSCE 110 Programming Basics of Python: Variables, Expressions, and nput/output Dr. Tiffani L. Williams Department of Computer Science and Engineering Texas A&M University Fall 2011 Python Python was developed

### Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June 2014. Dr.-Ing.

Computers An Introduction to Programming with Python CCHSG Visit June 2014 Dr.-Ing. Norbert Völker Many computing devices are embedded Can you think of computers/ computing devices you may have in your

### ESCI 386 Scientific Programming, Analysis and Visualization with Python. Lesson 5 Program Control

ESCI 386 Scientific Programming, Analysis and Visualization with Python Lesson 5 Program Control 1 Interactive Input Input from the terminal is handled using the raw_input() function >>> a = raw_input('enter

### University of Hull Department of Computer Science. Wrestling with Python Week 01 Playing with Python

Introduction Welcome to our Python sessions. University of Hull Department of Computer Science Wrestling with Python Week 01 Playing with Python Vsn. 1.0 Rob Miles 2013 Please follow the instructions carefully.

### Programming Exercises

s CMPS 5P (Professor Theresa Migler-VonDollen ): Assignment #8 Problem 6 Problem 1 Programming Exercises Modify the recursive Fibonacci program given in the chapter so that it prints tracing information.

### To understand the concept of objects and how they can be used to simplify programs.

Chapter 5 Objects and Graphics Objectives To understand the concept of objects and how they can be used to simplify programs. To be familiar with the various objects available in the graphics library.

### PIC 10A. Lecture 7: Graphics II and intro to the if statement

PIC 10A Lecture 7: Graphics II and intro to the if statement Setting up a coordinate system By default the viewing window has a coordinate system already set up for you 10-10 10-10 The origin is in the

### Introduction to Python

WEEK ONE Introduction to Python Python is such a simple language to learn that we can throw away the manual and start with an example. Traditionally, the first program to write in any programming language

### The Command Line. Matthew Bender. Friday 9 th October, CMSC Command Line Workshop

The Command Line Matthew Bender CMSC Command Line Workshop Friday 9 th October, 2015 Matthew Bender (2015) The Command Line Friday 9 th October, 2015 1 / 22 Functions Section 1 Functions Matthew Bender

### Reporting Manual. Prepared by. NUIT Support Center Northwestern University

Reporting Manual Prepared by NUIT Support Center Northwestern University Updated: February 2013 CONTENTS 1. Introduction... 1 2. Reporting... 1 2.1 Reporting Functionality... 1 2.2 Creating Reports...

### Python strings. Girls Programming Network School of Information Technologies University of Sydney. Mini-lecture 5

Python strings Girls Programming Network School of Information Technologies University of Sydney Mini-lecture 5 Strings raw input Types Summary 2 Outline 1 Strings 2 Reading input with raw input 3 Types

### How do I share a file with a friend or trusted associate?

Sharing Information How do I share a file with a friend or trusted associate? Sharing a file in InformationSAFE is easy. The share utility in InformationSAFE allows you to securely share your information

### Crash Dive into Python

ECPE 170 University of the Pacific Crash Dive into Python 2 Lab Schedule Ac:vi:es Assignments Due Today Lab 8 Python Due by Oct 26 th 5:00am Endianness Lab 9 Tuesday Due by Nov 2 nd 5:00am Network programming

### I.T. Services. Quick Start Guide. E mail at Hope

Quick Start Guide To E mail at Hope Accessing Google Mail Go to Hope s homepage (www.hope.ac.uk) and click on Current Staff / Students Click on Email N.B. Staff who are accessing Google Mail on campus

### Lecture 11: while loops CS1068+ Introductory Programming in Python. for loop revisited. while loop. Summary. Dr Kieran T. Herley 2016/17.

Lecture 11: while loops CS1068+ Introductory Programming in Python Dr Kieran T. Herley Python s while loop. Summary Department of Computer Science University College Cork 2016/17 KH (02/11/16) Lecture

### Graphics Module Reference

Graphics Module Reference John M. Zelle Version 3.2, Spring 2005 1 Overview The package graphics.py is a simple object oriented graphics library designed to make it very easy for novice programmers to

### Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information.

Excel Tutorial Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information. Working with Data Entering and Formatting Data Before entering data

### Preview of Real Python Course 1, Intro to Python. Fundamentals: Functions and Loops

Preview of Real Python Course 1, Intro to Python If you like what you see, consider purchasing the entire course on RealPython.com - for just \$60, you will get all three courses, with over 1,200 pages

### #4: While Loop Reading: Chapter3

CS 130R: Programming in Python #4: While Loop Reading: Chapter3 Contents Constants While loop Infinite loop Break Continue Constants Similar to variables, but their names are with capital letters and their

### First Bytes Programming Lab 2

First Bytes Programming Lab 2 This lab is available online at www.cs.utexas.edu/users/scottm/firstbytes. Introduction: In this lab you will investigate the properties of colors and how they are displayed

### Scatter Plots with Error Bars

Chapter 165 Scatter Plots with Error Bars Introduction The procedure extends the capability of the basic scatter plot by allowing you to plot the variability in Y and X corresponding to each point. Each

### 13.0 Central Limit Theorem

13.0 Central Limit Theorem Discuss Midterm/Answer Questions Box Models Expected Value and Standard Error Central Limit Theorem 1 13.1 Box Models A Box Model describes a process in terms of making repeated

### Introduction to Python Using the Raspberry Pi

Introduction to Python Using the Raspberry Pi Getting Started with the Raspberry Pi Before we get into any programming, let s first get started using the. The Raspberry Pi is a small, ARM-based single-board

### 4 Other useful features on the course web page. 5 Accessing SAS

1 Using SAS outside of ITCs Statistical Methods and Computing, 22S:30/105 Instructor: Cowles Lab 1 Jan 31, 2014 You can access SAS from off campus by using the ITC Virtual Desktop Go to https://virtualdesktopuiowaedu

### CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

### What is a Mail Merge?

NDUS Training and Documentation What is a Mail Merge? A mail merge is generally used to personalize form letters, to produce mailing labels and for mass mailings. A mail merge can be very helpful if you

### QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall-2015 1

QUIZ-II Write a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. (For

### DS-0321 FFT Analysis Software Operation manual Basic operation procedure for Configuration Setting

DS-0321 FFT Analysis Software Operation manual Basic operation procedure for Configuration Setting ONO SOKKI CO., LTD. The Configuration window is used to make various settings and operations of the DS-0321

### NextGen EHR: Clinic Password and User Preferences Setup in PROD

NextGen EHR: Clinic Password and User Preferences Setup in PROD FALL 2014 1 Click the NextGen icon on your desktop. The NextGen Application Window opens. FALL 2014 2 Click the icon for EHR. The EHR login

### Graphics Module Reference

Graphics Module Reference John M. Zelle Version 4.1, Fall 2010 1 Overview The package graphics.py is a simple object oriented graphics library designed to make it very easy for novice programmers to experiment

### I.T. Services. Quick Start Guide. E mail at Hope

Quick Start Guide To E mail at Hope Accessing Google Mail Go to Hope s homepage (www.hope.ac.uk) and click on Current Staff / Students Click on Email The following box will appear on the screen: Enter

### Internet Traffic Measurements. Shell Scripts. School of Electrical Engineering AALTO UNIVERSITY

Internet Traffic Measurements Shell Scripts School of Electrical Engineering AALTO UNIVERSITY Page 1 Contents What is a shell script?... 2 Useful Linux commands... 2 Useful commands for data manipulation...

### Teaching London Computing

Teaching London Computing A Level Computer Science Programming GUI in Python William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London Outline A first program

### PHP Tutorial From beginner to master

PHP Tutorial From beginner to master PHP is a powerful tool for making dynamic and interactive Web pages. PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.

### Introduction to Python

Introduction to Python COMP 089H Fall 2015 Written by Tanya Amert last updated 9/30/15 IDLE IDLE is a simple interactive Python development environment. It consists of a Python shell, which evaluates what

### UPS System Capacity Management Configuration Utility

StruxureWare Power Monitoring 7.0 UPS System Capacity Management Configuration Utility User Guide UPS System Capacity Management Configuration Utility This document provides an overview of the StruxureWare

### Microsoft Office Excel

The purpose of this guide is to give you an overview of the Microsoft Office 365 Excel web application. Creating a New Excel Workbook Log in to Office 365 using your student ID and password in the usual

### Android Based Appointment Scheduler and Location Helper using file operation

IOSR Journal of Computer Engineering (IOSR-JCE) e-issn: 2278-0661, p- ISSN: 2278-8727Volume 16, Issue 2, Ver. XI (Mar-Apr. 2014), PP 71-75 Android Based Appointment Scheduler and Location Helper using

### Python Evaluation Rules

Python Evaluation Rules UW CSE 160 http://tinyurl.com/dataprogramming Michael Ernst and Isaac Reynolds mernst@cs.washington.edu August 2, 2016 Contents 1 Introduction 2 1.1 The Structure of a Python Program................................

### Self-review 9.3 What is PyUnit? PyUnit is the unit testing framework that comes as standard issue with the Python system.

Testing, Testing 9 Self-Review Questions Self-review 9.1 What is unit testing? It is testing the functions, classes and methods of our applications in order to ascertain whether there are bugs in the code.

### CSC 221: Computer Programming I. Fall 2011

CSC 221: Computer Programming I Fall 2011 Python control statements operator precedence importing modules random, math conditional execution: if, if-else, if-elif-else counter-driven repetition: for conditional

### 1. BASICS OF PYTHON. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman

1. BASICS OF PYTHON JHU Physics & Astronomy Python Workshop 2015 Lecturer: Mubdi Rahman HOW IS THIS WORKSHOP GOING TO WORK? We will be going over all the basics you need to get started and get productive

### NLP Programming Tutorial 0 - Programming Basics

NLP Programming Tutorial 0 - Programming Basics Graham Neubig Nara Institute of Science and Technology (NAIST) 1 About this Tutorial 14 parts, starting from easier topics Each time: During the tutorial:

### 4. Descriptive Statistics: Measures of Variability and Central Tendency

4. Descriptive Statistics: Measures of Variability and Central Tendency Objectives Calculate descriptive for continuous and categorical data Edit output tables Although measures of central tendency and

### Introduction to Problem Solving and Programming in Python.

Introduction to Problem Solving and Programming in Python http://cis-linux1.temple.edu/~tuf80213/courses/temple/cis1051/ Overview Repeating Types of loops While loops For loop Nested loops 2 Loops A loops

### G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P.

SQL databases An introduction AMP: Apache, mysql, PHP This installations installs the Apache webserver, the PHP scripting language, and the mysql database on your computer: Apache: runs in the background

### Fundamentals of Python: First Programs. Chapter 3: Control Statements modifications by Mr. Dave Clausen

Fundamentals of Python: First Programs Chapter 3: Control Statements modifications by Mr. Dave Clausen Objectives After completing this chapter, you will be able to: Write a loop to repeat a sequence of

### Model Paper Computer Science Objective. Paper Code Time Allowed: 20 minutes

Note: This is Model Paper for guidance of students & teachers. Q. Model Paper Computer Science Objective Intermediate Part II ( th Class) Examination Session -4 and onward Total marks: 7 Paper Code Time

### A skip list container class in Python

A skip list container class in Python Abstract An alternative to balanced trees John W. Shipman 2012-11-29 13:23 Describes a module in the Python programming language that implements a skip list, a data

### OptionBot 2.0 User Instructions

V.2.0 OptionBot 2.0 User Instructions Contents 1. Getting Started 2. Functions 3. Optimal Settings & Trading 4. Disclaimer 1. Getting Started ***IMPORTANT*** Optionbot 2.0 is optimised for use with Firefox

### Doing Multiple Regression with SPSS. In this case, we are interested in the Analyze options so we choose that menu. If gives us a number of choices:

Doing Multiple Regression with SPSS Multiple Regression for Data Already in Data Editor Next we want to specify a multiple regression analysis for these data. The menu bar for SPSS offers several options:

### Crash Dive into Python

ECPE 170 University of the Pacific Crash Dive into Python 2 Lab Schedule Ac:vi:es Assignments Due Today Lab 11 Network Programming Due by Dec 1 st 5:00am Python Lab 12 Next Week Due by Dec 8 th 5:00am

### Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering

Engineering Problem Solving and Excel EGN 1006 Introduction to Engineering Mathematical Solution Procedures Commonly Used in Engineering Analysis Data Analysis Techniques (Statistics) Curve Fitting techniques

### Appendix K Introduction to Microsoft Visual C++ 6.0

Appendix K Introduction to Microsoft Visual C++ 6.0 This appendix serves as a quick reference for performing the following operations using the Microsoft Visual C++ integrated development environment (IDE):

### NCSS Statistical Software

Chapter 155 Introduction graphically display tables of means (or medians) and variability. Following are examples of the types of charts produced by this procedure. The error bars may represent the standard

### 7. In the boxed unlabeled field, enter the last 4 digits of your Social Security number.

CREATE YOUR MYVIEW LOGIN To access myview while ensuring security, you will be given an encrypted access key token. You will use this token the first time you log into myview. Once you have successfully

### AMS 5 CHANCE VARIABILITY

AMS 5 CHANCE VARIABILITY The Law of Averages When tossing a fair coin the chances of tails and heads are the same: 50% and 50%. So if the coin is tossed a large number of times, the number of heads and

### Graphics and Graphical User Interfaces (part 1)

Caltech/LEAD Summer 2012 Computer Science Lecture 11: July 18, 2012 Graphics and Graphical User Interfaces (part 1) Graphics This lecture Graphical user interfaces (GUIs) Event handling and event loops

### LAB 1 REPRESENTATION OF NUMBERS AND INTRODUCTION TO C

LAB 1 REPRESENTATION OF NUMBERS AND INTRODUCTION TO C 1. LAB OBJECTIVE The objective of this lab is to review binary numbers and to review/introduce you to the C programming language and the MATLAB environment.

### CS 100 Introduction to Computer Science Lab 1 - Playing with Python Due September 21/23, 11:55 PM

CS 100 Introduction to Computer Science Lab 1 - Playing with Python Due September 21/23, 11:55 PM First, a word about due dates. If you are in the Tuesday lab section, your assignment is due Monday night

### SECTION 2-1: OVERVIEW SECTION 2-2: FREQUENCY DISTRIBUTIONS

SECTION 2-1: OVERVIEW Chapter 2 Describing, Exploring and Comparing Data 19 In this chapter, we will use the capabilities of Excel to help us look more carefully at sets of data. We can do this by re-organizing

### Stratford School Academy Schemes of Work

Number of weeks (between 6&8) Content of the unit Assumed prior learning (tested at the beginning of the unit) Page 1 of 9 7 The unit is subdivided into six learning hours spread across six lessons in

### Advanced Programming with LEGO NXT MindStorms

Advanced Programming with LEGO NXT MindStorms Presented by Tom Bickford Executive Director Maine Robotics Advanced topics in MindStorms Loops Switches Nested Loops and Switches Data Wires Program view

### Lesson 3 - Processing a Multi-Layer Yield History. Exercise 3-4

Lesson 3 - Processing a Multi-Layer Yield History Exercise 3-4 Objective: Develop yield-based management zones. 1. File-Open Project_3-3.map. 2. Double click the Average Yield surface component in the

### Chapter 4 State Machines

Chapter 4 State Machines 6.01 Spring 2011 April 25, 2011 117 Chapter 4 State Machines State machines are a method of modeling systems whose output depends on the entire history of their inputs, and not

### FIRST STEPS WITH SCILAB

powered by FIRST STEPS WITH SCILAB The purpose of this tutorial is to get started using Scilab, by discovering the environment, the main features and some useful commands. Level This work is licensed under