introduction (week 1)

Size: px
Start display at page:

Download "introduction (week 1)"

Transcription

1 introduction (week 1) Matt Valeriote 7 January, 2019

2 Introduction Administrative trivia

3 Introduction Administrative trivia Instructor: Matt Valeriote

4 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject:

5 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject:

6 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject: HH 323; office and by appointment

7 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject: HH 323; office and by appointment TAs: Aghigh Farhadichesmehmorvari and Nik Pocuca

8 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject: HH 323; office and by appointment TAs: Aghigh Farhadichesmehmorvari and Nik Pocuca Grading:

9 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject: HH 323; office and by appointment TAs: Aghigh Farhadichesmehmorvari and Nik Pocuca Grading: midterms (two of them) 20% each

10 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject: HH 323; office and by appointment TAs: Aghigh Farhadichesmehmorvari and Nik Pocuca Grading: midterms (two of them) 20% each final 40%

11 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject: HH 323; office and by appointment TAs: Aghigh Farhadichesmehmorvari and Nik Pocuca Grading: midterms (two of them) 20% each final 40% quizzes 5%

12 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject: HH 323; office and by appointment TAs: Aghigh Farhadichesmehmorvari and Nik Pocuca Grading: midterms (two of them) 20% each final 40% quizzes 5% assignments 10%

13 Introduction Administrative trivia Instructor: Matt Valeriote please include 1mp3 in Subject: HH 323; office and by appointment TAs: Aghigh Farhadichesmehmorvari and Nik Pocuca Grading: midterms (two of them) 20% each final 40% quizzes 5% assignments 10% project 5%

14 Laptop policy

15 Laptop policy Course webpage: and Avenue

16 Laptop policy Course webpage: and Avenue Expectations of professor and students

17 Laptop policy Course webpage: and Avenue Expectations of professor and students Textbook (optional): Gries et al. Practical Programming 2d ed., available from the bookstore, the publisher (The Pragmatic Bookshelf), or amazon.ca

18 Laptop policy Course webpage: and Avenue Expectations of professor and students Textbook (optional): Gries et al. Practical Programming 2d ed., available from the bookstore, the publisher (The Pragmatic Bookshelf), or amazon.ca also see resources

19 Laptop policy Course webpage: and Avenue Expectations of professor and students Textbook (optional): Gries et al. Practical Programming 2d ed., available from the bookstore, the publisher (The Pragmatic Bookshelf), or amazon.ca also see resources Course content: reasonable balance among

20 Laptop policy Course webpage: and Avenue Expectations of professor and students Textbook (optional): Gries et al. Practical Programming 2d ed., available from the bookstore, the publisher (The Pragmatic Bookshelf), or amazon.ca also see resources Course content: reasonable balance among nitty-gritty practical programming instruction:

21 Laptop policy Course webpage: and Avenue Expectations of professor and students Textbook (optional): Gries et al. Practical Programming 2d ed., available from the bookstore, the publisher (The Pragmatic Bookshelf), or amazon.ca also see resources Course content: reasonable balance among nitty-gritty practical programming instruction:... I just sat down in front of a text editor, with nothing but thoughts, and ended up with a program that did exactly what I wanted it to a few hours later... (ankit panda)

22 Laptop policy Course webpage: and Avenue Expectations of professor and students Textbook (optional): Gries et al. Practical Programming 2d ed., available from the bookstore, the publisher (The Pragmatic Bookshelf), or amazon.ca also see resources Course content: reasonable balance among nitty-gritty practical programming instruction:... I just sat down in front of a text editor, with nothing but thoughts, and ended up with a program that did exactly what I wanted it to a few hours later... (ankit panda) conceptual foundations of computing/computer science

23 Laptop policy Course webpage: and Avenue Expectations of professor and students Textbook (optional): Gries et al. Practical Programming 2d ed., available from the bookstore, the publisher (The Pragmatic Bookshelf), or amazon.ca also see resources Course content: reasonable balance among nitty-gritty practical programming instruction:... I just sat down in front of a text editor, with nothing but thoughts, and ended up with a program that did exactly what I wanted it to a few hours later... (ankit panda) conceptual foundations of computing/computer science context/culture of mathematical/scientific computing

24 Laptop policy Course webpage: and Avenue Expectations of professor and students Textbook (optional): Gries et al. Practical Programming 2d ed., available from the bookstore, the publisher (The Pragmatic Bookshelf), or amazon.ca also see resources Course content: reasonable balance among nitty-gritty practical programming instruction:... I just sat down in front of a text editor, with nothing but thoughts, and ended up with a program that did exactly what I wanted it to a few hours later... (ankit panda) conceptual foundations of computing/computer science context/culture of mathematical/scientific computing interesting applications

25 Installing Python

26 Installing Python CodeLab:

27 Installing Python CodeLab: Jupyter:

28 Installing Python CodeLab: Jupyter: PythonAnywhere

29 Installing Python CodeLab: Jupyter: PythonAnywhere Everyone must have access to a computer with Python3 installed.

30 Installing Python CodeLab: Jupyter: PythonAnywhere Everyone must have access to a computer with Python3 installed. See installation instructions

31 More interesting stuff Using computers in math and science

32 More interesting stuff Using computers in math and science math users vs. understanders vs. developers

33 More interesting stuff Using computers in math and science math users vs. understanders vs. developers develop conjectures; draw pictures; write manuscripts

34 More interesting stuff Using computers in math and science math users vs. understanders vs. developers develop conjectures; draw pictures; write manuscripts mathematical proof (e.g. four-colo(u)r theorem and other examples); computer algebra

35 More interesting stuff Using computers in math and science math users vs. understanders vs. developers develop conjectures; draw pictures; write manuscripts mathematical proof (e.g. four-colo(u)r theorem and other examples); computer algebra applied math: cryptography, tomography, logistics, finance, fluid dynamics,...

36 More interesting stuff Using computers in math and science math users vs. understanders vs. developers develop conjectures; draw pictures; write manuscripts mathematical proof (e.g. four-colo(u)r theorem and other examples); computer algebra applied math: cryptography, tomography, logistics, finance, fluid dynamics,... applied statistics: bioinformatics, Big Data/analytics,...

37 Fun! Hello, world (always the first program you write in a new computer language) print('hello, world!') ## hello, world! Python as a fancy calculator: print(62**2*27/5+3) ## reference: Python intro section 3.1.1

38 Interlude: about Python

39 Interlude: about Python programming languages

40 Interlude: about Python programming languages Python: scripting; high-level; glue; general-purpose; flexible

41 Interlude: about Python programming languages Python: scripting; high-level; glue; general-purpose; flexible contrast: domain-specific scripting languages (MATLAB, R, Mathematica, Maple)

42 Interlude: about Python programming languages Python: scripting; high-level; glue; general-purpose; flexible contrast: domain-specific scripting languages (MATLAB, R, Mathematica, Maple) contrast: general-purpose scripting languages (Perl, PHP)

43 Interlude: about Python programming languages Python: scripting; high-level; glue; general-purpose; flexible contrast: domain-specific scripting languages (MATLAB, R, Mathematica, Maple) contrast: general-purpose scripting languages (Perl, PHP) contrast: general-purpose compiled languages (Java, C, C++) ( close to the metal )

44 Interlude: about Python programming languages Python: scripting; high-level; glue; general-purpose; flexible contrast: domain-specific scripting languages (MATLAB, R, Mathematica, Maple) contrast: general-purpose scripting languages (Perl, PHP) contrast: general-purpose compiled languages (Java, C, C++) ( close to the metal ) relatively modern (1990s; Python 3, 2008)

45 Interlude: about Python programming languages Python: scripting; high-level; glue; general-purpose; flexible contrast: domain-specific scripting languages (MATLAB, R, Mathematica, Maple) contrast: general-purpose scripting languages (Perl, PHP) contrast: general-purpose compiled languages (Java, C, C++) ( close to the metal ) relatively modern (1990s; Python 3, 2008) currently the 3rd most popular computer language overall (up from 8th in 2015); most popular for teaching

46 Interlude: about Python programming languages Python: scripting; high-level; glue; general-purpose; flexible contrast: domain-specific scripting languages (MATLAB, R, Mathematica, Maple) contrast: general-purpose scripting languages (Perl, PHP) contrast: general-purpose compiled languages (Java, C, C++) ( close to the metal ) relatively modern (1990s; Python 3, 2008) currently the 3rd most popular computer language overall (up from 8th in 2015); most popular for teaching well suited to mathematical/scientific/technical (NumPy; SciPy; Python in Finance)

47 Interlude: about Python programming languages Python: scripting; high-level; glue; general-purpose; flexible contrast: domain-specific scripting languages (MATLAB, R, Mathematica, Maple) contrast: general-purpose scripting languages (Perl, PHP) contrast: general-purpose compiled languages (Java, C, C++) ( close to the metal ) relatively modern (1990s; Python 3, 2008) currently the 3rd most popular computer language overall (up from 8th in 2015); most popular for teaching well suited to mathematical/scientific/technical (NumPy; SciPy; Python in Finance) ex.: Sage; BioPython

48 the prime walk (from math.stackexchange.ca)

49 the prime walk (from math.stackexchange.ca) 1. start at the origin, heading right, counting up from 1

50 the prime walk (from math.stackexchange.ca) 1. start at the origin, heading right, counting up from 1 2. move forward one space, counting up, until you find a prime

51 the prime walk (from math.stackexchange.ca) 1. start at the origin, heading right, counting up from 1 2. move forward one space, counting up, until you find a prime 3. turn 90 clockwise

52 the prime walk (from math.stackexchange.ca) 1. start at the origin, heading right, counting up from 1 2. move forward one space, counting up, until you find a prime 3. turn 90 clockwise 4. repeat steps 2 and 3 until you get bored

53 the prime walk (from math.stackexchange.ca) 1. start at the origin, heading right, counting up from 1 2. move forward one space, counting up, until you find a prime 3. turn 90 clockwise 4. repeat steps 2 and 3 until you get bored Note:

54 the prime walk (from math.stackexchange.ca) 1. start at the origin, heading right, counting up from 1 2. move forward one space, counting up, until you find a prime 3. turn 90 clockwise 4. repeat steps 2 and 3 until you get bored Note: Here is some python code that implements this procedure: matt/1mp3/primewalk.py

55 the prime walk (from math.stackexchange.ca) 1. start at the origin, heading right, counting up from 1 2. move forward one space, counting up, until you find a prime 3. turn 90 clockwise 4. repeat steps 2 and 3 until you get bored Note: Here is some python code that implements this procedure: matt/1mp3/primewalk.py easier to understand/modify than write from scratch

56 the prime walk (from math.stackexchange.ca) 1. start at the origin, heading right, counting up from 1 2. move forward one space, counting up, until you find a prime 3. turn 90 clockwise 4. repeat steps 2 and 3 until you get bored Note: Here is some python code that implements this procedure: matt/1mp3/primewalk.py easier to understand/modify than write from scratch build on existing components (modules)

57 Interfaces

58 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T)

59 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor

60 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor integrated development environment (IDE)

61 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor integrated development environment (IDE) not MS Word!

62 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor integrated development environment (IDE) not MS Word! Features

63 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor integrated development environment (IDE) not MS Word! Features syntax highlighting

64 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor integrated development environment (IDE) not MS Word! Features syntax highlighting bracket-matching

65 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor integrated development environment (IDE) not MS Word! Features syntax highlighting bracket-matching integrated help

66 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor integrated development environment (IDE) not MS Word! Features syntax highlighting bracket-matching integrated help integrated debugging tools

67 Interfaces command line/console (Spyder: Consoles/Open an IPython Console or Ctrl+T) programming editor integrated development environment (IDE) not MS Word! Features syntax highlighting bracket-matching integrated help integrated debugging tools integrated project management tools

68 Assignment and types (PP Ch. 2)

69 Assignment and types (PP Ch. 2) superficially simple

70 Assignment and types (PP Ch. 2) superficially simple set aside memory space, create a symbol that points to that space

71 Assignment and types (PP Ch. 2) superficially simple set aside memory space, create a symbol that points to that space = is the assignment operator ( gets, not equals )

72 Assignment and types (PP Ch. 2) superficially simple set aside memory space, create a symbol that points to that space = is the assignment operator ( gets, not equals ) <variable> = <value>

73 Assignment and types (PP Ch. 2) superficially simple set aside memory space, create a symbol that points to that space = is the assignment operator ( gets, not equals ) <variable> = <value> variable names

74 Assignment and types (PP Ch. 2) superficially simple set aside memory space, create a symbol that points to that space = is the assignment operator ( gets, not equals ) <variable> = <value> variable names what is legal? (names include letters, numbers, underscores, must start with a letter or underscore)

75 Assignment and types (PP Ch. 2) superficially simple set aside memory space, create a symbol that points to that space = is the assignment operator ( gets, not equals ) <variable> = <value> variable names what is legal? (names include letters, numbers, underscores, must start with a letter or underscore) what is customary? convention is variables_like_this ( snake case )

76 Assignment and types (PP Ch. 2) superficially simple set aside memory space, create a symbol that points to that space = is the assignment operator ( gets, not equals ) <variable> = <value> variable names what is legal? (names include letters, numbers, underscores, must start with a letter or underscore) what is customary? convention is variables_like_this ( snake case ) what works well? v vs. temporary_variable_for_loop

77 Assignment and types (PP Ch. 2) superficially simple set aside memory space, create a symbol that points to that space = is the assignment operator ( gets, not equals ) <variable> = <value> variable names what is legal? (names include letters, numbers, underscores, must start with a letter or underscore) what is customary? convention is variables_like_this ( snake case ) what works well? v vs. temporary_variable_for_loop same principles apply to file, directory/folder names

78 variables are of different types

79 variables are of different types built-in: integer (int), floating-point (float), complex, Boolean (bool: True or False),

80 variables are of different types built-in: integer (int), floating-point (float), complex, Boolean (bool: True or False), dynamic typing

81 variables are of different types built-in: integer (int), floating-point (float), complex, Boolean (bool: True or False), dynamic typing Python usually does what you mean, converts types when sensible

82 variables are of different types built-in: integer (int), floating-point (float), complex, Boolean (bool: True or False), dynamic typing Python usually does what you mean, converts types when sensible (relatively) strong typing

83 variables are of different types built-in: integer (int), floating-point (float), complex, Boolean (bool: True or False), dynamic typing Python usually does what you mean, converts types when sensible (relatively) strong typing try type(x) for different possibilities (x=3; x=3.0; x="a")

84 variables are of different types built-in: integer (int), floating-point (float), complex, Boolean (bool: True or False), dynamic typing Python usually does what you mean, converts types when sensible (relatively) strong typing try type(x) for different possibilities (x=3; x=3.0; x="a") what happens if you try x=a?

85 variables are of different types built-in: integer (int), floating-point (float), complex, Boolean (bool: True or False), dynamic typing Python usually does what you mean, converts types when sensible (relatively) strong typing try type(x) for different possibilities (x=3; x=3.0; x="a") what happens if you try x=a? don t be afraid to experiment!

86 x=3 y=3.0 z="a" q=complex(1,2) type(x+y) ## mixed arithmetic type(int(x+y)) ## int(), float() convert explicitly type(x+z) type(q) type(x+q) type(true) type(true+1) Try these in a python console or check out the Python tutor for these examples

87 Arithmetic operators, precedence

88 Arithmetic operators, precedence exponentiation (**)

89 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-)

90 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-) multiplication/division (*,/,//=integer division,%=remainder)

91 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-) multiplication/division (*,/,//=integer division,%=remainder) addition/subtraction (+, - ( binary ))

92 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-) multiplication/division (*,/,//=integer division,%=remainder) addition/subtraction (+, - ( binary )) When in doubt, use parentheses! Puzzle: what is -1**2? Why?

93 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-) multiplication/division (*,/,//=integer division,%=remainder) addition/subtraction (+, - ( binary )) When in doubt, use parentheses! Puzzle: what is -1**2? Why? Logical operators (PP 5.1)

94 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-) multiplication/division (*,/,//=integer division,%=remainder) addition/subtraction (+, - ( binary )) When in doubt, use parentheses! Puzzle: what is -1**2? Why? Logical operators (PP 5.1) comparison: (==,!=)

95 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-) multiplication/division (*,/,//=integer division,%=remainder) addition/subtraction (+, - ( binary )) When in doubt, use parentheses! Puzzle: what is -1**2? Why? Logical operators (PP 5.1) comparison: (==,!=) inequalities: >, <, >=, <=,

96 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-) multiplication/division (*,/,//=integer division,%=remainder) addition/subtraction (+, - ( binary )) When in doubt, use parentheses! Puzzle: what is -1**2? Why? Logical operators (PP 5.1) comparison: (==,!=) inequalities: >, <, >=, <=, basic logic: (and, or, not)

97 Arithmetic operators, precedence exponentiation (**) negation ( unary minus ) (-) multiplication/division (*,/,//=integer division,%=remainder) addition/subtraction (+, - ( binary )) When in doubt, use parentheses! Puzzle: what is -1**2? Why? Logical operators (PP 5.1) comparison: (==,!=) inequalities: >, <, >=, <=, basic logic: (and, or, not) remember your truth tables, e.g. not(a and b) equals (not a) or (not b)

98 a = True; b = False; c=1; d=0 a and b not(a and not b) a and not(b>c) a==c ## careful! not(d) not(c) operator precedence: same issue as order of operations in arithmetic; not has higher precedence than and, or. When in doubt use parentheses...

99 Truth tables A B A and B A or B not A True True True True False True False False True False False True False True True False False False False True

100 Truth tables A B A and B A or B not A True True True True False True False False True False False True False True True False False False False True Logical expressions

101 Truth tables A B A and B A or B not A True True True True False True False False True False False True False True True False False False False True Logical expressions The logical expression: not not a and not b or a is equivalent to ((not (not a)) and (not b)) or a since the operator not takes precedence over the operators and and or.

102 Truth tables A B A and B A or B not A True True True True False True False False True False False True False True True False False False False True Logical expressions The logical expression: not not a and not b or a is equivalent to ((not (not a)) and (not b)) or a since the operator not takes precedence over the operators and and or. So if a = True and b = False then this evaluates to True.

103 Truth tables A B A and B A or B not A True True True True False True False False True False False True False True True False False False False True Logical expressions The logical expression: not not a and not b or a is equivalent to ((not (not a)) and (not b)) or a since the operator not takes precedence over the operators and and or. So if a = True and b = False then this evaluates to True. Since not not a is equivalent to just a for a having value True or False, then the above expression can be simplified to just (a and not b) or a. Can you see that this expression is equivalent to a, i.e, it has value True precisely when a does?

104 From CodingBat: We have two monkeys, a and b, and the parameters a_smile and b_smile indicate if each is smiling. We are in trouble if they are both smiling or if neither of them is smiling. Return True if we are in trouble. monkey_trouble(true, True) -> True monkey_trouble(false, False) -> True monkey_trouble(true, False) -> False More CodingBat problems: squirrel_play cigar_party

105 String operations (PP chapter 4) reference: Python intro section 3.1.2

106 String operations (PP chapter 4) reference: Python intro section Less generally important, but fun

107 String operations (PP chapter 4) reference: Python intro section Less generally important, but fun + concatenates

108 String operations (PP chapter 4) reference: Python intro section Less generally important, but fun + concatenates * replicates and concatenates

109 String operations (PP chapter 4) reference: Python intro section Less generally important, but fun + concatenates * replicates and concatenates in searches for a substring

110 String operations (PP chapter 4) reference: Python intro section Less generally important, but fun + concatenates * replicates and concatenates in searches for a substring One more useful string operation: len(s) returns the length (number of characters)

111 a = "xyz" b = "abc" a+1 ## error a+b b*3 (a+" ")*5 b in a CodingBat problems: make_abba make_tags

112 Indexing and slicing

113 Indexing and slicing Indexing

114 Indexing and slicing Indexing Extracting elements is called indexing a list

115 Indexing and slicing Indexing Extracting elements is called indexing a list Indexing starts from zero

116 Indexing and slicing Indexing Extracting elements is called indexing a list Indexing starts from zero Negative indices count backward from the end of the string (-1 is the last element)

117 Indexing and slicing Indexing Extracting elements is called indexing a list Indexing starts from zero Negative indices count backward from the end of the string (-1 is the last element) Indexing a non-existent element gives an error

118 Indexing and slicing Indexing Extracting elements is called indexing a list Indexing starts from zero Negative indices count backward from the end of the string (-1 is the last element) Indexing a non-existent element gives an error

119 Indexing and slicing Indexing Extracting elements is called indexing a list Indexing starts from zero Negative indices count backward from the end of the string (-1 is the last element) Indexing a non-existent element gives an error

120 Slicing

121 Slicing Extracting (consecutive) sets of elements is called slicing

122 Slicing Extracting (consecutive) sets of elements is called slicing Slicing non-existent element(s) gives a truncated result

123 Slicing Extracting (consecutive) sets of elements is called slicing Slicing non-existent element(s) gives a truncated result Slicing specifies start, end, step (or stride )

124 Slicing Extracting (consecutive) sets of elements is called slicing Slicing non-existent element(s) gives a truncated result Slicing specifies start, end, step (or stride ) Leaving out a bit goes from the beginning/to the end

125 Slicing Extracting (consecutive) sets of elements is called slicing Slicing non-existent element(s) gives a truncated result Slicing specifies start, end, step (or stride ) Leaving out a bit goes from the beginning/to the end Slicing works on strings too!

126 x[:] # everything x[a:b] # element a (zero-indexed) to b-1 x[a:] # a to end x[:b] # beginning to b-1 x[a:b:n] # from a to b-1 in steps of n generate a list of odd numbers from 3 to 15 reverse a string? String slicing practice From CodingBat: first_two first_half

Introduction to Mathematical and Scientific Programming TUTORIAL WEEK 1 (MATH 1MP3) Winter 2019

Introduction to Mathematical and Scientific Programming TUTORIAL WEEK 1 (MATH 1MP3) Winter 2019 TUTORIAL WEEK 1 Introduction to Mathematical and Scientific Programming (MATH 1MP3) Winter 2019 Important Links 1- The Course Website https://ms.mcmaster.ca/~matt/1mp3.html 2- Python https://www.python.org/downloads/

More information

Lecture 2: Variables & Assignments

Lecture 2: Variables & Assignments http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 2: Variables & Assignments (Sections 2.1-2.3,2.5) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik SAMS Programming A/B Lecture #1 Introductions July 3, 2017 Mark Stehlik Outline for Today Overview of Course A Python intro to be continued in lab on Wednesday (group A) and Thursday (group B) 7/3/2017

More information

Lecture 1. Types, Expressions, & Variables

Lecture 1. Types, Expressions, & Variables Lecture 1 Types, Expressions, & Variables About Your Instructor Director: GDIAC Game Design Initiative at Cornell Teach game design (and CS 1110 in fall) 8/29/13 Overview, Types & Expressions 2 Helping

More information

Algorithms and Programming I. Lecture#12 Spring 2015

Algorithms and Programming I. Lecture#12 Spring 2015 Algorithms and Programming I Lecture#12 Spring 2015 Think Python How to Think Like a Computer Scientist By :Allen Downey Installing Python Follow the instructions on installing Python and IDLE on your

More information

Chapter 2 Working with Data Types and Operators

Chapter 2 Working with Data Types and Operators JavaScript, Fourth Edition 2-1 Chapter 2 Working with Data Types and Operators At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics

More information

Variables and Values

Variables and Values Variables and Values Names Variables (which hold values) and functions (which are blocks of code) both have names Names must begin with a letter and may contain letters, digits, and underscores Names are

More information

Introduction to Python Part 1. Brian Gregor Research Computing Services Information Services & Technology

Introduction to Python Part 1. Brian Gregor Research Computing Services Information Services & Technology Introduction to Python Part 1 Brian Gregor Research Computing Services Information Services & Technology RCS Team and Expertise Our Team Scientific Programmers Systems Administrators Graphics/Visualization

More information

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007 CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007 Course Web Site http://www.nps.navy.mil/cs/facultypages/squire/cs2900 All course related materials will be posted

More information

Midterms Save the Dates!

Midterms Save the Dates! University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Primitive Data Types Arithmetic Operators Readings Your textbook is Big Java (3rd Ed). This Week s Reading: Ch 2.1-2.5, Ch 4.1-4.2.

More information

Introduction to Python and programming. Ruth Anderson UW CSE 160 Winter 2017

Introduction to Python and programming. Ruth Anderson UW CSE 160 Winter 2017 Introduction to Python and programming Ruth Anderson UW CSE 160 Winter 2017 1 1. Python is a calculator 2. A variable is a container 3. Different types cannot be compared 4. A program is a recipe 2 0.

More information

CS 320: Concepts of Programming Languages

CS 320: Concepts of Programming Languages CS 320: Concepts of Programming Languages Wayne Snyder Computer Science Department Boston University Lecture 04: Basic Haskell Continued o Polymorphic Types o Type Inference with Polymorphism o Standard

More information

Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2

Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2 Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2 Ziad Matni, Ph.D. Dept. of Computer Science, UCSB Your Instructor Your instructor: Ziad Matni, Ph.D(zee-ahd

More information

Lecture 1. Course Overview Types & Expressions

Lecture 1. Course Overview Types & Expressions Lecture 1 Course Overview Types & Expressions CS 1110 Spring 2012: Walker White Outcomes: Basics of (Java) procedural programming Usage of assignments, conditionals, and loops. Ability to write recursive

More information

Overview (4) CPE 101 mod/reusing slides from a UW course. Assignment Statement: Review. Why Study Expressions? D-1

Overview (4) CPE 101 mod/reusing slides from a UW course. Assignment Statement: Review. Why Study Expressions? D-1 CPE 101 mod/reusing slides from a UW course Overview (4) Lecture 4: Arithmetic Expressions Arithmetic expressions Integer and floating-point (double) types Unary and binary operators Precedence Associativity

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 1 Data and expressions reading: 2.1 self-check: 1-4 videos: Ch. 2 #1 2 Data types type: A category or set of data

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

CSE 1001 Fundamentals of Software Development 1. Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018

CSE 1001 Fundamentals of Software Development 1. Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018 CSE 1001 Fundamentals of Software Development 1 Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018 Identifiers, Variables and Data Types Reserved Words Identifiers in C Variables and Values

More information

ENGG1811 Computing for Engineers Week 1 Introduction to Programming and Python

ENGG1811 Computing for Engineers Week 1 Introduction to Programming and Python ENGG1811 Computing for Engineers Week 1 Introduction to Programming and Python ENGG1811 UNSW, CRICOS Provider No: 00098G W4 Computers have changed engineering http://www.noendexport.com/en/contents/48/410.html

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 Copyright 2009 by Pearson Education Data and expressions reading: 2.1 self-check: 1-4 videos: Ch. 2 #1 Copyright

More information

Python The way of a program. Srinidhi H Asst Professor Dept of CSE, MSRIT

Python The way of a program. Srinidhi H Asst Professor Dept of CSE, MSRIT Python The way of a program Srinidhi H Asst Professor Dept of CSE, MSRIT 1 Problem Solving Problem solving means the ability to formulate problems, think creatively about solutions, and express a solution

More information

Numerical Methods. Centre for Mathematical Sciences Lund University. Spring 2015

Numerical Methods. Centre for Mathematical Sciences Lund University. Spring 2015 Numerical Methods Claus Führer Alexandros Sopasakis Centre for Mathematical Sciences Lund University Spring 2015 Preface These notes serve as a skeleton for the course. They document together with the

More information

Fundamentals: Expressions and Assignment

Fundamentals: Expressions and Assignment Fundamentals: Expressions and Assignment A typical Python program is made up of one or more statements, which are executed, or run, by a Python console (also known as a shell) for their side effects e.g,

More information

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja

More information

COMP Primitive and Class Types. Yi Hong May 14, 2015

COMP Primitive and Class Types. Yi Hong May 14, 2015 COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

More information

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

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15 1 LECTURE 1: INTRO Introduction to Scientific Python, CME 193 Jan. 9, 2014 web.stanford.edu/~ermartin/teaching/cme193-winter15 Eileen Martin Some slides are from Sven Schmit s Fall 14 slides 2 Course Details

More information

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards Language Reference Manual Introduction The purpose of

More information

Get It Interpreter Scripts Arrays. Basic Python. K. Cooper 1. 1 Department of Mathematics. Washington State University. Basics

Get It Interpreter Scripts Arrays. Basic Python. K. Cooper 1. 1 Department of Mathematics. Washington State University. Basics Basic Python K. 1 1 Department of Mathematics 2018 Python Guido van Rossum 1994 Original Python was developed to version 2.7 2010 2.7 continues to receive maintenance New Python 3.x 2008 The 3.x version

More information

Lecture 1. Course Overview, Python Basics

Lecture 1. Course Overview, Python Basics Lecture 1 Course Overview, Python Basics We Are Very Full! Lectures and Labs are at fire-code capacity We cannot add sections or seats to lectures You may have to wait until someone drops No auditors are

More information

Boolean Algebra Boolean Algebra

Boolean Algebra Boolean Algebra What is the result and type of the following expressions? Int x=2, y=15; float u=2.0, v=15.0; -x x+y x-y x*v y / x x/y y%x x%y u*v u/v v/u u%v x * u (x+y)*u u / (x-x) x++ u++ u = --x u = x -- u *= ++x

More information

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this

More information

CSC 120 Computer Science for the Sciences. Week 1 Lecture 2. UofT St. George January 11, 2016

CSC 120 Computer Science for the Sciences. Week 1 Lecture 2. UofT St. George January 11, 2016 CSC 120 Computer Science for the Sciences Week 1 Lecture 2 UofT St. George January 11, 2016 Introduction to Python & Foundations of computer Programming Variables, DataTypes, Arithmetic Expressions Functions

More information

CS1 Lecture 3 Jan. 18, 2019

CS1 Lecture 3 Jan. 18, 2019 CS1 Lecture 3 Jan. 18, 2019 Office hours for Prof. Cremer and for TAs have been posted. Locations will change check class website regularly First homework assignment will be available Monday evening, due

More information

I. Variables and Data Type week 3

I. Variables and Data Type week 3 I. Variables and Data Type week 3 variable: a named memory (i.e. RAM, which is volatile) location used to store/hold data, which can be changed during program execution in algebra: 3x + 5 = 20, x = 5,

More information

Boolean Logic & Branching Lab Conditional Tests

Boolean Logic & Branching Lab Conditional Tests I. Boolean (Logical) Operations Boolean Logic & Branching Lab Conditional Tests 1. Review of Binary logic Three basic logical operations are commonly used in binary logic: and, or, and not. Table 1 lists

More information

Lecture 2. Variables & Assignment

Lecture 2. Variables & Assignment Lecture 2 Variables & Assignment Announcements for Today If Not Done Already Enroll in Piazza Sign into CMS Fill out the Survey Complete AI Quiz Read the tetbook Chapter 1 (browse) Chapter 2 (in detail)

More information

COSC 490 Computational Topology

COSC 490 Computational Topology COSC 490 Computational Topology Dr. Joe Anderson Fall 2018 Salisbury University Course Structure Weeks 1-2: Python and Basic Data Processing Python commonly used in industry & academia Weeks 3-6: Group

More information

Visual C# Instructor s Manual Table of Contents

Visual C# Instructor s Manual Table of Contents Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms

More information

Lecture 1. Course Overview, Python Basics

Lecture 1. Course Overview, Python Basics Lecture 1 Course Overview, Python Basics We Are Very Full! Lectures are at fire-code capacity. We cannot add sections or seats to lectures You may have to wait until someone drops No auditors are allowed

More information

egrapher Language Reference Manual

egrapher Language Reference Manual egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction

More information

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

STATS 507 Data Analysis in Python. Lecture 0: Introduction and Administrivia STATS 507 Data Analysis in Python Lecture 0: Introduction and Administrivia Data science has completely changed our world Course goals Establish a broad background in Python programming Prepare you for

More information

Topic 4 Expressions and variables

Topic 4 Expressions and variables Topic 4 Expressions and variables "Once a person has understood the way variables are used in programming, he has understood the quintessence of programming." -Professor Edsger W. Dijkstra Based on slides

More information

Chapter 7. Expressions and Assignment Statements ISBN

Chapter 7. Expressions and Assignment Statements ISBN Chapter 7 Expressions and Assignment Statements ISBN 0-321-49362-1 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit

More information

CS1 Lecture 3 Jan. 22, 2018

CS1 Lecture 3 Jan. 22, 2018 CS1 Lecture 3 Jan. 22, 2018 Office hours for me and for TAs have been posted, locations will change check class website regularly First homework available, due Mon., 9:00am. Discussion sections tomorrow

More information

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables

More information

PYTHON FOR MEDICAL PHYSICISTS. Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital

PYTHON FOR MEDICAL PHYSICISTS. Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital PYTHON FOR MEDICAL PHYSICISTS Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital TUTORIAL 1: INTRODUCTION Thursday 1 st October, 2015 AGENDA 1. Reference list 2.

More information

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public

More information

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th COMS 1003 Fall 2005 Introduction to Computer Programming in C Bits, Boolean Logic & Discrete Math September 13 th Hello World! Logistics See the website: http://www.cs.columbia.edu/~locasto/ Course Web

More information

Scientific Computing: Lecture 1

Scientific Computing: Lecture 1 Scientific Computing: Lecture 1 Introduction to course, syllabus, software Getting started Enthought Canopy, TextWrangler editor, python environment, ipython, unix shell Data structures in Python Integers,

More information

Chapter 7. Expressions and Assignment Statements

Chapter 7. Expressions and Assignment Statements Chapter 7 Expressions and Assignment Statements Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment

More information

Course Overview, Python Basics

Course Overview, Python Basics CS 1110: Introduction to Computing Using Python Lecture 1 Course Overview, Python Basics [Andersen, Gries, Lee, Marschner, Van Loan, White] Interlude: Why learn to program? (which is subtly distinct from,

More information

Chapter 2 Basic Elements of C++

Chapter 2 Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion

More information

CS101: Intro to Computing Summer Week 1

CS101: Intro to Computing Summer Week 1 CS101: Intro to Computing Summer 2016 Week 1 Administrivia Homework 1 is posted (due Friday) Administrivia i>clicker Wednesday and Friday i>clicker tests After that, i>clicker attendance Need to register

More information

Introduction to programming with Python

Introduction to programming with Python Introduction to programming with Python Ing. Lelio Campanile 1/61 Main Goal - Introduce you to programming - introduce you to the most essential feature of python programming 2/61 Before to start The name

More information

Introduction to Python: Data types. HORT Lecture 8 Instructor: Kranthi Varala

Introduction to Python: Data types. HORT Lecture 8 Instructor: Kranthi Varala Introduction to Python: Data types HORT 59000 Lecture 8 Instructor: Kranthi Varala Why Python? Readability and ease-of-maintenance Python focuses on well-structured easy to read code Easier to understand

More information

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering?

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering? Lecture 1 Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering? Welcome to ENGR 102 Syllabus review Your Time Expectations (in

More information

CME 193: Introduction to Scientific Python Lecture 1: Introduction

CME 193: Introduction to Scientific Python Lecture 1: Introduction CME 193: Introduction to Scientific Python Lecture 1: Introduction Nolan Skochdopole stanford.edu/class/cme193 1: Introduction 1-1 Contents Administration Introduction Basics Variables Control statements

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

CSE 115. Introduction to Computer Science I

CSE 115. Introduction to Computer Science I CSE 115 Introduction to Computer Science I Note about posted slides The slides we post will sometimes contain additional slides/content, beyond what was presented in any one lecture. We do this so the

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

WEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS

WEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS WEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS OPERATORS Review: Data values can appear as literals or be stored in variables/constants Data values can be returned by method calls Operators: special symbols

More information

Introduction to Python Programming

Introduction to Python Programming Introduction to Python Programming (3) Variables, Types, Operators S. Thater and A. Friedrich Saarland University Winter Semester 2011/2012 S. Thater and A. Friedrich ( Saarland University) Introduction

More information

Introduction to: Computers & Programming: Review prior to 1 st Midterm

Introduction to: Computers & Programming: Review prior to 1 st Midterm Introduction to: Computers & Programming: Review prior to 1 st Midterm Adam Meyers New York University Summary Some Procedural Matters Summary of what you need to Know For the Test and To Go Further in

More information

Our Strategy for Learning Fortran 90

Our Strategy for Learning Fortran 90 Our Strategy for Learning Fortran 90 We want to consider some computational problems which build in complexity. evaluating an integral solving nonlinear equations vector/matrix operations fitting data

More information

CS Advanced Unix Tools & Scripting

CS Advanced Unix Tools & Scripting & Scripting Spring 2011 Hussam Abu-Libdeh slides by David Slater March 4, 2011 Hussam Abu-Libdeh slides by David Slater & Scripting Python An open source programming language conceived in the late 1980s.

More information

CIS192: Python Programming

CIS192: Python Programming CIS192: Python Programming Introduction Harry Smith University of Pennsylvania January 18, 2017 Harry Smith (University of Pennsylvania) CIS 192 Lecture 1 January 18, 2017 1 / 34 Outline 1 Logistics Rooms

More information

MODULE 02: BASIC COMPUTATION IN JAVA

MODULE 02: BASIC COMPUTATION IN JAVA MODULE 02: BASIC COMPUTATION IN JAVA Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment

More information

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG) SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2

More information

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING KEY CONCEPTS COMP 10 EXPLORING COMPUTER SCIENCE Lecture 2 Variables, Types, and Programs Problem Definition of task to be performed (by a computer) Algorithm A particular sequence of steps that will solve

More information

Expressions and Casting. Data Manipulation. Simple Program 11/5/2013

Expressions and Casting. Data Manipulation. Simple Program 11/5/2013 Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence

More information

Primitive Types. Four integer types: Two floating-point types: One character type: One boolean type: byte short int (most common) long

Primitive Types. Four integer types: Two floating-point types: One character type: One boolean type: byte short int (most common) long Primitive Types Four integer types: byte short int (most common) long Two floating-point types: float double (most common) One character type: char One boolean type: boolean 1 2 Primitive Types, cont.

More information

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014 CMPSCI 250: Introduction to Computation Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014 Things, Sets, and Strings The Mathematical Method Administrative Stuff The Objects of Mathematics

More information

Objective- Students will be able to use the Order of Operations to evaluate algebraic expressions. Evaluating Algebraic Expressions

Objective- Students will be able to use the Order of Operations to evaluate algebraic expressions. Evaluating Algebraic Expressions Objective- Students will be able to use the Order of Operations to evaluate algebraic expressions. Evaluating Algebraic Expressions Variable is a letter or symbol that represents a number. Variable (algebraic)

More information

VARIABLES & ASSIGNMENTS

VARIABLES & ASSIGNMENTS Fall 2018 CS150 - Intro to CS I 1 VARIABLES & ASSIGNMENTS Sections 2.1, 2.2, 2.3, 2.4 Fall 2018 CS150 - Intro to CS I 2 Variables Named storage location for holding data named piece of memory You need

More information

Software II: Principles of Programming Languages. Why Expressions?

Software II: Principles of Programming Languages. Why Expressions? Software II: Principles of Programming Languages Lecture 7 Expressions and Assignment Statements Why Expressions? Expressions are the fundamental means of specifying computations in a programming language

More information

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2 Python for Analytics Python Fundamentals RSI Chapters 1 and 2 Learning Objectives Theory: You should be able to explain... General programming terms like source code, interpreter, compiler, object code,

More information

Scientific Python. 1 of 10 23/11/ :00

Scientific Python.   1 of 10 23/11/ :00 Scientific Python Neelofer Banglawala Kevin Stratford nbanglaw@epcc.ed.ac.uk kevin@epcc.ed.ac.uk Original course authors: Andy Turner Arno Proeme 1 of 10 23/11/2015 00:00 www.archer.ac.uk support@archer.ac.uk

More information

Language Reference Manual

Language Reference Manual ALACS Language Reference Manual Manager: Gabriel Lopez (gal2129) Language Guru: Gabriel Kramer-Garcia (glk2110) System Architect: Candace Johnson (crj2121) Tester: Terence Jacobs (tj2316) Table of Contents

More information

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types. Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified

More information

Class #1. introduction, functions, variables, conditionals

Class #1. introduction, functions, variables, conditionals Class #1 introduction, functions, variables, conditionals what is processing hello world tour of the grounds functions,expressions, statements console/debugging drawing data types and variables decisions

More information

Expressions and Casting

Expressions and Casting Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence

More information

WELCOME! (download slides and.py files and follow along!) LECTURE 1

WELCOME! (download slides and.py files and follow along!) LECTURE 1 WELCOME! (download slides and.py files and follow along!) 6.0001 LECTURE 1 6.0001 LECTURE 1 1 TODAY course info what is computation python basics mathematical operations python variables and types NOTE:

More information

Fall 2017 CISC124 9/16/2017

Fall 2017 CISC124 9/16/2017 CISC124 Labs start this week in JEFF 155: Meet your TA. Check out the course web site, if you have not already done so. Watch lecture videos if you need to review anything we have already done. Problems

More information

V2 2/4/ Ch Programming in C. Flow of Control. Flow of Control. Flow of control The order in which statements are executed

V2 2/4/ Ch Programming in C. Flow of Control. Flow of Control. Flow of control The order in which statements are executed Programming in C 1 Flow of Control Flow of control The order in which statements are executed Transfer of control When the next statement executed is not the next one in sequence 2 Flow of Control Control

More information

Flow of Control. Flow of control The order in which statements are executed. Transfer of control

Flow of Control. Flow of control The order in which statements are executed. Transfer of control 1 Programming in C Flow of Control Flow of control The order in which statements are executed Transfer of control When the next statement executed is not the next one in sequence 2 Flow of Control Control

More information

Chapter 7. Expressions and Assignment Statements (updated edition 11) ISBN

Chapter 7. Expressions and Assignment Statements (updated edition 11) ISBN Chapter 7 Expressions and Assignment Statements (updated edition 11) ISBN 0-321-49362-1 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean

More information

Expressions and Assignment Statements

Expressions and Assignment Statements Expressions and Assignment Statements Introduction Expressions are the fundamental means of specifying computations in a programming language To understand expression evaluation, need to be familiar with

More information

MEIN 50010: Python Introduction

MEIN 50010: Python Introduction : Python Fabian Sievers Higgins Lab, Conway Institute University College Dublin Wednesday, 2017-10-04 Outline Goals Teach basic programming concepts Apply these concepts using Python Use Python Packages

More information

Getting started with Java

Getting started with Java Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving

More information

Selection statements. CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington

Selection statements. CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington Selection s CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1 Book reference Book: The practice of Computing Using Python 2-nd edition Second hand book

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

MATLIP: MATLAB-Like Language for Image Processing

MATLIP: MATLAB-Like Language for Image Processing COMS W4115: Programming Languages and Translators MATLIP: MATLAB-Like Language for Image Processing Language Reference Manual Pin-Chin Huang (ph2249@columbia.edu) Shariar Zaber Kazi (szk2103@columbia.edu)

More information

Java Notes. 10th ICSE. Saravanan Ganesh

Java Notes. 10th ICSE. Saravanan Ganesh Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 1 2 Data and expressions reading: 2.1 3 The computer s view Internally, computers store everything as 1 s and 0

More information

CA4003 Compiler Construction Assignment Language Definition

CA4003 Compiler Construction Assignment Language Definition CA4003 Compiler Construction Assignment Language Definition David Sinclair 2017-2018 1 Overview The language is not case sensitive. A nonterminal, X, is represented by enclosing it in angle brackets, e.g.

More information

Problem Solving With C++ Ninth Edition

Problem Solving With C++ Ninth Edition CISC 1600/1610 Computer Science I Programming in C++ Professor Daniel Leeds dleeds@fordham.edu JMH 328A Introduction to programming with C++ Learn Fundamental programming concepts Key techniques Basic

More information

Operators. Lecture 3 COP 3014 Spring January 16, 2018

Operators. Lecture 3 COP 3014 Spring January 16, 2018 Operators Lecture 3 COP 3014 Spring 2018 January 16, 2018 Operators Special built-in symbols that have functionality, and work on operands operand an input to an operator Arity - how many operands an operator

More information

Chapter 7. Expressions and Assignment Statements

Chapter 7. Expressions and Assignment Statements Chapter 7 Expressions and Assignment Statements Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming Java Primitive Data Types; Arithmetic Expressions Yang (Richard) Yang Computer Science Department Yale University 308A Watson, Phone: 432-6400 Email: yry@cs.yale.edu

More information

Admin. CS 112 Introduction to Programming. Recap: Java Static Methods. Recap: Decomposition Example. Recap: Static Method Example

Admin. CS 112 Introduction to Programming. Recap: Java Static Methods. Recap: Decomposition Example. Recap: Static Method Example Admin CS 112 Introduction to Programming q Programming assignment 2 to be posted tonight Java Primitive Data Types; Arithmetic Expressions Yang (Richard) Yang Computer Science Department Yale University

More information