Before Reading Week. Lists. List methods. Nested Lists. Looping through lists using for loops. While loops

Size: px
Start display at page:

Download "Before Reading Week. Lists. List methods. Nested Lists. Looping through lists using for loops. While loops"

Transcription

1 Before Reading Week Lists List methods Nested Lists Looping through lists using for loops While loops

2 This Week and Maybe Next Special Characters Review Files What are they? Opening and closing files Reading and writing to files Comma Separated Value Files

3 Strings Using Conversion Specifiers We some'mes would like to insert values of variables into strings: A1 = 60 A2 = 75 A3 = 88 We would like: The average of 60, 75 and 88 is How do we print this with our variables? >>>print( The average of, A1,,, A2, and, A3, is, (A1+A2+A3)/3) Does this work?

4 Strings Using Conversion Specifiers We displayed: The average of 60, 75 and 88 is Q. What s wrong? A. Spacing is wrong around commas and periods. We have many more decimal places than wanted. Q. How can we fix it? A. Use conversion specifiers. >>>print( The average of %d, %d and %d is %.2f %(A1, A2, A3, (A1+A2+A3)/3.0)) The average of 60, 75 and 88 is

5 Common Conversion Specifiers %d display the object as a decimal integer %f display the object as a floating point with 6 decimal places %.2f display the object as a floating point with 2 decimal places %s display the object as a string Q. What else do we use % for? A. Modulus. We say that % is overloaded.

6 Invisible Characters How do we indicate a tab, newline or or inside a string? \t tab \ double quote \n new line \ single quote \\ backslash These are called escape sequences. print( This string has a \n newline and a \t tab. This string has a newline and a tab.

7 Files Files what are they? Can think of as a collection of stored information Computer thinks as a sequence of bits possibly arranged in characters Files have names: my_python.py, homework.txt, etc. What can we do with a file? Read from a file and write to a file

8 Opening Files How do we open a file in Python? myfile = open( story.txt, r ) Open is the Python function Story.txt is the name of the file to be opened myfile is a variable that is assigned the file object (also called stream or reader). r is a string indicating what we will do with the file (read, write, append)

9 Using Files After we are finished with a file we must close it: myfile.close() When we write to a file, we have two choices: Write: myfile = open( filename, w ) Append: myfile = open( filename, a ) write replaces the file filename append appends to the file filename

10 Reading Files There are many ways to read from a file. 1. Using a for loop: myfile = open( filename, r ) for line in myfile: <do something with the line> 2. Read the whole file at once into a list of strings: myfile = open( filename, r ) list_of_lines = myfile.readlines()

11 Reading Files 3. Read the entire file into a string: myfile = open( filename, r ) s = myfile.read() 4. Read a specific number of characters: myfile = open( filename, r ) s = myfile.read(10) reads 10 characters s = myfile.read(10) reads then next 10 characters

12 Reading Files 5. Read one line at a time: myfile = open( filename, r ) line = myfile.readline() reads a line line = myfile.readline() reads the next line

13 End Of File (EOF) How do we know when we reach the end of the file? A for loop automatically recognizes EOF. for line in myfile: <do something with the line> Here we have to check for the end of file: line = myfile.readline() reads the next line and s = myfile.read(10) reads 10 characters The EOF character is the empty string.

14 Writing to a file First open the file for writing or appending: myfile = open( story.txt, w ) start the story myfile = open( story.txt, a ) continue the story Then write to the file: myfile.write( Once upon a time ) myfile.write( The end. ) Then close the file: myfile.close()

15 Reading from a CSV file Often we have comma-separated values data files: First Name, Last Name, Utorid Anna, Bretscher, bretsche Joe, Johnson, johnsonj Sally, Jordan, jordansa Why do we like CSV files? Spreadsheet applica@ons like excel understand it Many other programming languages also understand them Easy to generate ourselves

16 Reading from a CSV file How do we read comma-separated values data files: import io import csv csv_file = open( csv_filename.csv, r ) reader = csv.reader(csv_file) for line in reader: # read like an ordinary file # but line is a list

17 While Loops Sometimes we need to loop until a condition is met. For example: Ask user for a password twice If the passwords don t match, ask again until they match or the user quits

18 While Loop Example English example: Ask for password. Ask for password again. While the passwords don t match: Ask again.

19 While Loop Example Python example: password1 = input( Enter password: ) Ask for password again. While the passwords don t match: Ask again.

20 While Loop Example Python example: password1 = input( Enter password: ) password2 = input( Re-enter password: ) While the passwords don t match: Ask again.

21 While Loop Example Python example: password1 = input( Enter password: ) password2 = input( Re-enter password: ) while password1!= password2: Ask again.

22 While Loop Example Python example: password1 = input( Enter password: ) password2 = input( Re-enter password: ) while password1!= password2: password2 = input( Re-enter password: )

CSCA20 Worksheet Working with Files

CSCA20 Worksheet Working with Files CSCA20 Worksheet Working with Files 1 Philosophical question: what s a file? Q. A general answer? Q. A programmer s answer? 2 Opening and closing a file To start using a file, given its filename, you have

More information

CMSC201 Computer Science I for Majors

CMSC201 Computer Science I for Majors CMSC201 Computer Science I for Majors Lecture 16 File I/O All materials copyright UMBC and Dr. Katherine Gibson unless otherwise noted Last Class We Covered Using for loops Syntax Using it to iterate over

More information

What we already know. more of what we know. results, searching for "This" 6/21/2017. chapter 14

What we already know. more of what we know. results, searching for This 6/21/2017. chapter 14 What we already know chapter 14 Files and Exceptions II Files are bytes on disk. Two types, text and binary (we are working with text) open creates a connection between the disk contents and the program

More information

CMSC201 Computer Science I for Majors

CMSC201 Computer Science I for Majors CMSC201 Computer Science I for Majors Lecture 15 File I/O All materials copyright UMBC unless otherwise noted Last Class We Covered Python s tuple data structure Tuples in functions (and as return values)

More information

Text Input and Conditionals

Text Input and Conditionals Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

More information

1/25/2018. ECE 220: Computer Systems & Programming. Write Output Using printf. Use Backslash to Include Special ASCII Characters

1/25/2018. ECE 220: Computer Systems & Programming. Write Output Using printf. Use Backslash to Include Special ASCII Characters University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 220: Computer Systems & Programming Review: Basic I/O in C Allowing Input from the Keyboard, Output to the Monitor

More information

Gradebook Export/Import Instructions

Gradebook Export/Import Instructions Gradebook Export/Import Instructions Introduction Canvas gives the option to export the gradebook to a CSV file. You can open this file in a spreadsheet program and add or change grades, add columns and

More information

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes GIS 4653/5653: Spatial Programming and GIS More Python: Statements, Types, Functions, Modules, Classes Statement Syntax The if-elif-else statement Indentation and and colons are important Parentheses and

More information

age = 23 age = age + 1 data types Integers Floating-point numbers Strings Booleans loosely typed age = In my 20s

age = 23 age = age + 1 data types Integers Floating-point numbers Strings Booleans loosely typed age = In my 20s Intro to Python Python Getting increasingly more common Designed to have intuitive and lightweight syntax In this class, we will be using Python 3.x Python 2.x is still very popular, and the differences

More information

The Big Python Guide

The Big Python Guide The Big Python Guide Big Python Guide - Page 1 Contents Input, Output and Variables........ 3 Selection (if...then)......... 4 Iteration (for loops)......... 5 Iteration (while loops)........ 6 String

More information

File input and output if-then-else. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas

File input and output if-then-else. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas File input and output if-then-else Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Opening files The open() command returns a file object: = open(,

More information

4. Inputting data or messages to a function is called passing data to the function.

4. Inputting data or messages to a function is called passing data to the function. Test Bank for A First Book of ANSI C 4th Edition by Bronson Link full download test bank: http://testbankcollection.com/download/test-bank-for-a-first-book-of-ansi-c-4th-edition -by-bronson/ Link full

More information

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d. Gaddis: Starting Out with Python, 2e - Test Bank Chapter Two MULTIPLE CHOICE 1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical

More information

Chapter 5: Compatibility of Data Files

Chapter 5: Compatibility of Data Files Importing data from other format Files Chapter 5: Compatibility of Data Files Importing Text Files Creating a translation structure Example. Import 'EmployeePayroll.txt' as 'EmployeePayroll.mb' Importing

More information

program structure declarations and definitions expressions and statements more standard I/O

program structure declarations and definitions expressions and statements more standard I/O imperative week 2 and definitions expressions and more standard I/O Ritsumeikan University College of Information Science and Engineering Ian Piumarta 1 / 21 : typical #include ... // library,

More information

C: How to Program. Week /Mar/05

C: How to Program. Week /Mar/05 1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers

More information

File input and output and conditionals. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas

File input and output and conditionals. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas File input and output and conditionals Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Opening files The built-in open() function returns a file object:

More information

LESSON 4. The DATA TYPE char

LESSON 4. The DATA TYPE char LESSON 4 This lesson introduces some of the basic ideas involved in character processing. The lesson discusses how characters are stored and manipulated by the C language, how characters can be treated

More information

Lecture 3. Input, Output and Data Types

Lecture 3. Input, Output and Data Types Lecture 3 Input, Output and Data Types Goals for today Variable Types Integers, Floating-Point, Strings, Booleans Conversion between types Operations on types Input/Output Some ways of getting input, and

More information

Should you know scanf and printf?

Should you know scanf and printf? C-LANGUAGE INPUT & OUTPUT C-Language Output with printf Input with scanf and gets_s and Defensive Programming Copyright 2016 Dan McElroy Should you know scanf and printf? scanf is only useful in the C-language,

More information

Starting chapter 5. l First open file, and say purpose read or write inputfile = open('mydata.txt', 'r') outputfile = open('myresults.

Starting chapter 5. l First open file, and say purpose read or write inputfile = open('mydata.txt', 'r') outputfile = open('myresults. Starting chapter 5 Files l Mostly handle like any sequential data type A sequence of characters if a text file, or a sequence of bytes if a binary file l First open file, and say purpose read or write

More information

Functions. Genome 559: Introduction to Statistical and Computational Genomics Elhanan Borenstein

Functions. Genome 559: Introduction to Statistical and Computational Genomics Elhanan Borenstein Functions Genome 559: Introduction to Statistical and Computational Genomics Elhanan Borenstein Dictionaries: key:value pairs A quick review a.k.a. hash tables, lookup tables Examples: Word and definition

More information

Chapter 2, Part I Introduction to C Programming

Chapter 2, Part I Introduction to C Programming Chapter 2, Part I Introduction to C Programming C How to Program, 8/e, GE 2016 Pearson Education, Ltd. All rights reserved. 1 2016 Pearson Education, Ltd. All rights reserved. 2 2016 Pearson Education,

More information

Unit 4. Input/Output Functions

Unit 4. Input/Output Functions Unit 4 Input/Output Functions Introduction to Input/Output Input refers to accepting data while output refers to presenting data. Normally the data is accepted from keyboard and is outputted onto the screen.

More information

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed

More information

CMSC201 Computer Science I for Majors

CMSC201 Computer Science I for Majors CMSC201 Computer Science I for Majors Lecture 16 File I/O (continued) All materials copyright UMBC unless otherwise noted Last Class We Covered Escape sequences Uses a backslash (\) File I/O Input/Output

More information

sed Stream Editor Checks for address match, one line at a time, and performs instruction if address matched

sed Stream Editor Checks for address match, one line at a time, and performs instruction if address matched Week11 sed & awk sed Stream Editor Checks for address match, one line at a time, and performs instruction if address matched Prints all lines to standard output by default (suppressed by -n option) Syntax:

More information

Programming for Engineers Introduction to C

Programming for Engineers Introduction to C Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Intro to Computer Programming (ICP) Rab Nawaz Jadoon

Intro to Computer Programming (ICP) Rab Nawaz Jadoon Intro to Computer Programming (ICP) Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) What

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 05 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions / Comments? recap and some more details about variables, and if / else statements do lab work

More information

MeltLab Reporting Text, CSV or Excel

MeltLab Reporting Text, CSV or Excel MeltLab Reporting Text, CSV or Excel Graphic Statistical Process Control by MeltLab Systems 844-MeltLab www.meltlab.com Fast Accurate Comprehensive Setting up MeltLab Reporting for ASCII ASCII reporting

More information

Introduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1

Introduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1 Review Midterm Exam 1 Review Midterm Exam 1 Exam on Monday, October 7 Data Types and Variables = Data Types and Variables Basic Data Types Integers Floating Point Numbers Strings Data Types and Variables

More information

Textbook. Topic 8: Files and Exceptions. Files. Types of Files

Textbook. Topic 8: Files and Exceptions. Files. Types of Files Textbook Topic 8: Files and A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams 1 Strongly Recommended

More information

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program

More information

Introduction to Computer Programming in Python Dr. William C. Bulko. Data Types

Introduction to Computer Programming in Python Dr. William C. Bulko. Data Types Introduction to Computer Programming in Python Dr William C Bulko Data Types 2017 What is a data type? A data type is the kind of value represented by a constant or stored by a variable So far, you have

More information

COP4020 Programming Assignment 1 - Spring 2011

COP4020 Programming Assignment 1 - Spring 2011 COP4020 Programming Assignment 1 - Spring 2011 In this programming assignment we design and implement a small imperative programming language Micro-PL. To execute Mirco-PL code we translate the code to

More information

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program Overview - General Data Types - Categories of Words - The Three S s - Define Before Use - End of Statement - My First Program a description of data, defining a set of valid values and operations List of

More information

Fundamentals of Programming Session 4

Fundamentals of Programming Session 4 Fundamentals of Programming Session 4 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2011 These slides are created using Deitel s slides, ( 1992-2010 by Pearson Education, Inc).

More information

PYTHON. Values and Variables

PYTHON. Values and Variables December 13 2017 Naveen Sagayaselvaraj PYTHON Values and Variables Overview Integer Values Variables and Assignment Identifiers Floating-point Types User Input The eval Function Controlling the print Function

More information

Chapter 2 - Introduction to C Programming

Chapter 2 - Introduction to C Programming Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic

More information

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

while loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas while loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Hints on variable names Pick names that are descriptive Change a name if you decide there s a better

More information

Updating Users. Updating Users CHAPTER

Updating Users. Updating Users CHAPTER CHAPTER 18 Update the existing user information that is in the database by using the following procedure:, page 18-1 Retaining Stored Values, page 18-2 Using the BAT Spreadsheet to Create a CSV Data File

More information

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

for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Reminders use if - elif - else statements for conditional code blocks memorize the logical operators (==,!=,

More information

CS201 Some Important Definitions

CS201 Some Important Definitions CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data

More information

Iteration. # a and b are now equal # a and b are no longer equal Multiple assignment

Iteration. # a and b are now equal # a and b are no longer equal Multiple assignment Iteration 6.1. Multiple assignment As you may have discovered, it is legal to make more than one assignment to the same variable. A new assignment makes an existing variable refer to a new value (and stop

More information

CS 1301 Final Exam Review Guide

CS 1301 Final Exam Review Guide CS 1301 Final Exam Review Guide A. Programming and Algorithm 1. Binary, Octal-decimal, Decimal, and Hexadecimal conversion Definition Binary (base 2): 10011 = 1*2 4 + 0*2 3 + 0*2 2 + 1*2 1 + 1*2 0 Octal-decimal

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 5 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

More information

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points) Standard 11 Lesson 9 Introduction to C++( Up to Operators) 2MARKS 1. Why C++ is called hybrid language? C++ supports both procedural and Object Oriented Programming paradigms. Thus, C++ is called as a

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

CPSC 217 Midterm (Python 3 version)

CPSC 217 Midterm (Python 3 version) CPSC 217 Midterm (Python 3 version) Duration: 60 minutes 7 March 2011 This exam has 81 questions and 14 pages. This exam is closed book. No notes, books, calculators or electronic devices, or other assistance

More information

OpenGlobal Virtuemart Product Feeds

OpenGlobal Virtuemart Product Feeds OpenGlobal Virtuemart Product Feeds Instruction Manual Introduction This Joomla! component makes it easy to provide CSV datafeeds of all of your Virtuemart products for various external companies. The

More information

Python lab session 1

Python lab session 1 Python lab session 1 Dr Ben Dudson, Department of Physics, University of York 28th January 2011 Python labs Before we can start using Python, first make sure: ˆ You can log into a computer using your username

More information

University of Texas at Arlington, TX, USA

University of Texas at Arlington, TX, USA Dept. of Computer Science and Engineering University of Texas at Arlington, TX, USA A file is a collec%on of data that is stored on secondary storage like a disk or a thumb drive. Accessing a file means

More information

Sequences: Strings, Lists, and Files

Sequences: Strings, Lists, and Files Sequences: Strings, Lists, and Files Read: Chapter 5, Sections 11.1-11.3 from Chapter 11 in the textbook Strings: So far we have examined in depth two numerical types of data: integers (int) and floating

More information

Introduction to: Computers & Programming: Strings and Other Sequences

Introduction to: Computers & Programming: Strings and Other Sequences Introduction to: Computers & Programming: Strings and Other Sequences in Python Part I Adam Meyers New York University Outline What is a Data Structure? What is a Sequence? Sequences in Python All About

More information

3 The Building Blocks: Data Types, Literals, and Variables

3 The Building Blocks: Data Types, Literals, and Variables chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating

More information

CSCA20 Worksheet Strings

CSCA20 Worksheet Strings 1 Introduction to strings CSCA20 Worksheet Strings A string is just a sequence of characters. Why do you think it is called string? List some real life applications that use strings: 2 Basics We define

More information

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

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

for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Reminders use if - elif - else statements for conditional code blocks code blocks share the same indentation

More information

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

More information

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords.

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords. Chapter 1 File Extensions: Source code (cpp), Object code (obj), and Executable code (exe). Preprocessor processes directives and produces modified source Compiler takes modified source and produces object

More information

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

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

for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Must be indented for loop Allows you to perform an operation on each element in a list (or character in

More information

File Input/Output in Python. October 9, 2017

File Input/Output in Python. October 9, 2017 File Input/Output in Python October 9, 2017 Moving beyond simple analysis Use real data Most of you will have datasets that you want to do some analysis with (from simple statistics on few hundred sample

More information

The QuickStudy Guide for Zoho CRM

The QuickStudy Guide for Zoho CRM The QuickStudy Guide for Zoho CRM Susan Clark Cornerstone Solutions Inc. Houston The QuickStudy Guide for Zoho CRM Using Zoho Everyday How Did Quick Get Included in the Book Name? Using This QuickStudy

More information

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines. Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

Chapter 17. Fundamental Concepts Expressed in JavaScript

Chapter 17. Fundamental Concepts Expressed in JavaScript Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program

More information

MP 3 A Lexer for MiniJava

MP 3 A Lexer for MiniJava MP 3 A Lexer for MiniJava CS 421 Spring 2012 Revision 1.0 Assigned Wednesday, February 1, 2012 Due Tuesday, February 7, at 09:30 Extension 48 hours (penalty 20% of total points possible) Total points 43

More information

INTRODUCTION. a Data File

INTRODUCTION.  a Data File INTRODUCTION E-mail Utilities is a product that will perform various E-mail and E-commerce functions. It s main features are: E-mail data, spool, or IFS files to Internet users Write data or spool files

More information

Scheme: Strings Scheme: I/O

Scheme: Strings Scheme: I/O Scheme: Strings Scheme: I/O CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Wednesday, April 5, 2017 Glenn G. Chappell Department of Computer Science University of

More information

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Introduction to C Programming Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Printing texts Adding 2 integers Comparing 2 integers C.E.,

More information

DSV Library for Lisp

DSV Library for Lisp DSV Library for Lisp Gene Michael Stover created Sunday, 2005 June 19 updated Monday, 2005 July 11 Copyright copyright 2005 Gene Michael Stover. All rights reserved. Permission to copy, store, & view this

More information

Programming Languages & Translators. XML Document Manipulation Language (XDML) Language Reference Manual

Programming Languages & Translators. XML Document Manipulation Language (XDML) Language Reference Manual Programming Languages & Translators (COMS W4115) Department of Computer Science Columbia University Summer 2007 XML Document Manipulation Language (XDML) Language Reference Manual Luba Leyzerenok ll2310@columbia.edu

More information

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon Groups of up to three students may submit common solutions for each problem in this homework and in all future homeworks You are responsible

More information

Chapter 2 Input, Processing and Output. Hong Sun COSC 1436 Spring 2017 Jan 30, 2017

Chapter 2 Input, Processing and Output. Hong Sun COSC 1436 Spring 2017 Jan 30, 2017 Chapter 2 Input, Processing and Output Hong Sun COSC 1436 Spring 2017 Jan 30, 2017 Designing a Program Designing a Program o Programs must be carefully designed before they are written. Before beginning

More information

2 nd Week Lecture Notes

2 nd Week Lecture Notes 2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

More information

CS 25200: Systems Programming. Lecture 10: Shell Scripting in Bash

CS 25200: Systems Programming. Lecture 10: Shell Scripting in Bash CS 25200: Systems Programming Lecture 10: Shell Scripting in Bash Dr. Jef Turkstra 2018 Dr. Jeffrey A. Turkstra 1 Lecture 10 Getting started with Bash Data types Reading and writing Control loops Decision

More information

Reading data into R. 1. Data in human readable form, which can be inspected with a text editor.

Reading data into R. 1. Data in human readable form, which can be inspected with a text editor. Reading data into R There is a famous, but apocryphal, story about Mrs Beeton, the 19th century cook and writer, which says that she began her recipe for rabbit stew with the instruction First catch your

More information

Chapter 2: Overview of C++

Chapter 2: Overview of C++ Chapter 2: Overview of C++ Problem Solving, Abstraction, and Design using C++ 6e by Frank L. Friedman and Elliot B. Koffman C++ Background Introduced by Bjarne Stroustrup of AT&T s Bell Laboratories in

More information

LBSC 690: Information Technology Lecture 05 Structured data and databases

LBSC 690: Information Technology Lecture 05 Structured data and databases LBSC 690: Information Technology Lecture 05 Structured data and databases William Webber CIS, University of Maryland Spring semester, 2012 Interpreting bits "my" 13.5801 268 010011010110 3rd Feb, 2014

More information

COSC 2P91. Bringing it all together... Week 4b. Brock University. Brock University (Week 4b) Bringing it all together... 1 / 22

COSC 2P91. Bringing it all together... Week 4b. Brock University. Brock University (Week 4b) Bringing it all together... 1 / 22 COSC 2P91 Bringing it all together... Week 4b Brock University Brock University (Week 4b) Bringing it all together... 1 / 22 A note on practicality and program design... Writing a single, monolithic source

More information

CS 115 Lecture 4. More Python; testing software. Neil Moore

CS 115 Lecture 4. More Python; testing software. Neil Moore CS 115 Lecture 4 More Python; testing software Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 8 September 2015 Syntax: Statements A statement

More information

Variables, Constants, and Data Types

Variables, Constants, and Data Types Variables, Constants, and Data Types Strings and Escape Characters Primitive Data Types Variables, Initialization, and Assignment Constants Reading for this lecture: Dawson, Chapter 2 http://introcs.cs.princeton.edu/python/12types

More information

Converting File Input

Converting File Input Converting File Input As with the input func.on, the readline() method can only return strings If the file contains numerical data, the strings must be converted to the numerical value using the int()

More information

CSC 108H: Introduction to Computer Programming. Summer Marek Janicki

CSC 108H: Introduction to Computer Programming. Summer Marek Janicki CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki Administration Questions on the assignment at the end. There were some questions about the memory model from last week. Accordingly,

More information

How to bulk upload users

How to bulk upload users City & Guilds How to bulk upload users How to bulk upload users The purpose of this document is to guide a user how to bulk upload learners and tutors onto SmartScreen. 2014 City and Guilds of London Institute.

More information

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 07: Data Input and Output Readings: Chapter 4 Input /Output Operations A program needs

More information

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information

Mail Merge Quick Reference Guide

Mail Merge Quick Reference Guide Mail Merge Letters To mail merge letters two documents are needed: 1. The letter, including all text that does not change. 2. Recipient names and addresses (a) The document containing recipient names and

More information

Slide#1: A How-To Tutorial on How to Run Custom Reports in DOI LEARN.

Slide#1: A How-To Tutorial on How to Run Custom Reports in DOI LEARN. Slide#1: A How-To Tutorial on How to Run Custom Reports in DOI LEARN. Slide#2: Log into DOI LEARN: https://gm2.geolearning.com/geonext/doi/login.geo Enter your Username and Password. If you need a new

More information

UC Export Folders Version 3.5 for Worksite 8.x, 9.x x86

UC Export Folders Version 3.5 for Worksite 8.x, 9.x x86 UC Export Folders Version 3.5 for Worksite 8.x, 9.x x86 Exports folders and subfolders directly from workspaces, tabs and folders Filter documents and email messages Integrated into Filesite and Desksite

More information

OCR Pseudocode to Python

OCR Pseudocode to Python OCR Pseudocode to Python Syntax Topic OCR Pseudocode Result Python Local variables x = 10 x = 10 playername = "Sam" playername = "Sam" Global variables global currentuserid = 223 In Python, variables are

More information

Decaf Language Reference Manual

Decaf Language Reference Manual Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

More information

5. Excel Fundamentals

5. Excel Fundamentals 5. Excel Fundamentals Excel is a software product that falls into the general category of spreadsheets. Excel is one of several spreadsheet products that you can run on your PC. Others include 1-2-3 and

More information

User Commands sed ( 1 )

User Commands sed ( 1 ) NAME sed stream editor SYNOPSIS /usr/bin/sed [-n] script [file...] /usr/bin/sed [-n] [-e script]... [-f script_file]... [file...] /usr/xpg4/bin/sed [-n] script [file...] /usr/xpg4/bin/sed [-n] [-e script]...

More information

CSV Import Guide. Public FINAL V

CSV Import Guide. Public FINAL V CSV Import Guide FINAL V1.1 2018-03-01 This short guide demonstrates how to prepare and open a CSV data file using a spreadsheet application such as Excel. It does not cover all possible ways to open files.

More information

The MaSH Programming Language At the Statements Level

The MaSH Programming Language At the Statements Level The MaSH Programming Language At the Statements Level Andrew Rock School of Information and Communication Technology Griffith University Nathan, Queensland, 4111, Australia a.rock@griffith.edu.au June

More information

Reading and Writing Files. Keeping Data

Reading and Writing Files. Keeping Data Reading and Writing Files Keeping Data Why do we use files? For permanently storing data. For dealing with information too large to fit in memory. Sequential Access Files Think of files as being stored

More information