Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 2 Simple C Programs.
Advertisements

Introduction to Programming
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Algorithms Series of mathematical or variable manipulations Integer a,b,c a = 12 b = 22 c = a * b (what is c?) 12 * 22 = 264.
Introduction to C++ Programming. A Simple Program: Print a Line of Text // My First C++ Program #include int main( ) { cout
ITEC113 Algorithms and Programming Techniques
CS107 Introduction to Computer Science Lecture 2.
The Fundamentals of C++ Basic programming elements and concepts JPC and JWD © 2002 McGraw-Hill, Inc.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.
Prof. Alfred J Bird, Ph.D., NBCT Office – Wheatly 2nd floor Office Hours – MW 3:00PM to 4:00PM.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Prof. Alfred J Bird, Ph.D., NBCT Office – Wheatly 2nd floor Office Hours – MW 3:00PM.
C Programming Lecture 3. The Three Stages of Compiling a Program b The preprocessor is invoked The source code is modified b The compiler itself is invoked.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormack 3rd floor 607.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
Introduction to Computational Linguistics Programming I.
First Program  Open a file  In Shell  Type into the file: 3  You did it!!! You wrote your first instruction, or code, in python!
Programming in Python Part I Dr. Fatma Cemile Serçe Atılım University
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
Input, Output, and Processing
School of Computer Science & Information Technology G6DICP - Lecture 9 Software Development Techniques.
Prof. Alfred J Bird, Ph.D., NBCT Door Code for IT441 Students – * Office – Wheatly.
Jaeki Song ISQS6337 Lecture 01 Introduction. Jaeki Song ISQS6337 Instructor Name: Jaeki Song Office: BA 712 Office Hours Tuesday & Thursday 2:00-3:20.
Prof. Alfred J Bird, Ph.D., NBCT Door Code: * Office – McCormick 3rd floor 607 Office.
Variables and Expressions CMSC 201 Chang (rev )
Prof. Alfred J Bird, Ph.D., NBCT -bird.wikispaces.umb.edu/ Office – McCormick 3rd floor.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
3 1 Sending Data Using an Online Form CGI/Perl Programming By Diane Zak.
Prof. Alfred J Bird, Ph.D., NBCT Door Code for IT441 Students.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.
Intro to Nested Looping Intro to Computer Science CS1510 Dr. Sarah Diesburg.
Prof. Alfred J Bird, Ph.D., NBCT Door Code for IT441 Students.
Department of Electrical and Computer Engineering Introduction to Perl By Hector M Lugo-Cordero August 26, 2008.
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python Karsten Hokamp, PhD Genetics TCD, 03/11/2015.
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607.
Prof. Alfred J Bird, Ph.D., NBCT Door Code for IT441 Students.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
Introduction to C++.  Computers: CPU, Memory & Input / Output (IO)  Program: Sequence of instructions for the computer.  Operating system: Program.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607.
Perl for Bioinformatics Part 2 Stuart Brown NYU School of Medicine.
Bioinformatics Introduction to Perl. Introduction What is Perl Basic concepts in Perl syntax: – variables, strings, – Use of strict (explicit variables)
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3nd floor, room 607 Office Hours –Tuesday.
CS 101 – Oct. 7 Solving simple problems: create algorithm Structure of solution –Sequence of steps (1,2,3….) –Sometimes we need to make a choice –Sometimes.
First Program  Open a file  In Shell  Type into the file: 3  You did it!!! You wrote your first instruction, or code, in python!
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607.
CMSC201 Computer Science I for Majors Lecture 03 – Operators
CSCE 206 Structured Programming in C
Programming what is C++
Whatcha doin'? Aims: To start using Python. To understand loops.
IT441 Network Services Administration
IT441 Network Services Administration
Design & Technology Grade 7 Python
Variables, Expressions, and IO
MS-Excel Part 1.
Computer Programming Methodology Introduction to Java
Computational Thinking
Computational Thinking
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
Chapter 3: Selection Structures: Making Decisions
Unit 3: Variables in Java
Hardware is… Software is…
Presentation transcript:

Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and Thursday 4:00PM to 5:15PM

 A program to print out a list of the squares and cubes of the numbers from 1 to 20.  A program to ask for a number and test if it is a prime number.  A program to ask for two numbers and print out the sum of the numbers until it is told to stop.  A program to chose a specific action based upon an alpha input.

 Perl normally treats lines beginning with a # as a comment.  Get in the habit of including comments with your code.  Put a comment block at the beginning of your code which includes your name, the name of the module, date written and the purpose of the code.

 q// single quoted string  qq// double quoted string  In qq// the // can be replaced with any other non-alphanumeric character provided you use the same character on both ends of the string

 $a = “123”  $b = “456”  What do we get if we write this line of code,  print $a + $b;  How about this line of code,  print $a. $b;

 ** Exponentiation  -Unitary Negation  * Multiplication  /Division  %Modulo (Remainder)  +Addition  -Subtraction

 In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning. In simple words an algorithm is a step-by-step procedure for calculations.

 To use a file we need to attach a filehandle to it.  We do this using the open statement.  A simple example:  open (OUT1, “>testoutout.txt”);  If we open it we want to close it after we are done:  close (OUT1);  By convention a filehandle is codded in all capital letters

 We want to know for sure that we were successful opening the file so we include a test:  open (OUT1, “>>test.txt”) or die $!;

 To use a filehandle you wrap it in angle brackets.  print OUT1 “Hello World!\n”;  chomp ($in = );

 Remember what the redirectors do:  >  >>  <

1. Calculate the first 50 prime numbers and write them to an output file. 2. Calculate the first 40 members of the Fibonacci Series and write them to an output file. 3. Read the two output files and print them to the screen.

 Read pages 179 to 185 in the Perl book  Complete the three programs