Lecture 10: Boolean Expressions

Size: px
Start display at page:

Download "Lecture 10: Boolean Expressions"

Transcription

1 Lecture 10: Boolean Expressions CS1068+ Introductory Programming in Python Dr Kieran T. Herley Department of Computer Science University College Cork KH (12/10/17) Lecture 10: Boolean Expressions / 1

2 Summary Data type Boolean: variables, values and assignments. Boolean and, or, not operators. KH (12/10/17) Lecture 10: Boolean Expressions / 1

3 True/False values in Python Conditions in if statements have True/False outcomes: if mark >= 40: print( Pass! ) else : print( Fail ) Condition mark >= 40 is an expression with a True/False (Boolean) result KH (12/10/17) Lecture 10: Boolean Expressions / 1

4 George Boole Discovered Boolean Algebra algebraic system based on True/False values and variables AND, Or and NOT operators Important CS concept; foundation for computer circuit theory Self-taught mathematician first Professor of Mathematics UCC (then QCC) ; buried Blackrock George Boole ( ) KH (12/10/17) Lecture 10: Boolean Expressions / 1

5 Data type Boolean Data type Boolean Values: {True, False} Operators: and, or, not (details later) Usage Can use Booleans in assignments and prints etc. x = True y = False z = x and (not x or y) print(x, y, z) KH (12/10/17) Lecture 10: Boolean Expressions / 1

6 Data type Boolean cont d positive = x > 0 negative = x < 0 zero = x == 0 if negative : print( Negative ) else : print( Non negative ) Can use Boolean variables and values in conditions KH (12/10/17) Lecture 10: Boolean Expressions / 1

7 Composite conditions Suppose in order to enter CS student needs: at least 500 points a pass in maths KH (12/10/17) Lecture 10: Boolean Expressions / 1

8 Composite conditions Suppose in order to enter CS student needs: at least 500 points a pass in maths How to express a two-part condition like this? KH (12/10/17) Lecture 10: Boolean Expressions / 1

9 Boolean and operator Boolean operator and can be used to combine Boolean values or expressions X Y X and Y False False False False True False True False False True True True Composite X and Y is True if and only if X is True and Y is True KH (12/10/17) Lecture 10: Boolean Expressions / 1

10 Eligibility example if (maths mark >= 40) and (cao points >= 500 ): print( You're in! ) else : print( Sorry ) KH (12/10/17) Lecture 10: Boolean Expressions / 1

11 Eligibility example if (maths mark >= 40) and (cao points >= 500 ): print( You're in! ) else : print( Sorry ) Or alternatively has maths = maths mark >= 40 has points = cao points >= 500 if has maths and has points: print( You're in! ) else : print( Sorry ) KH (12/10/17) Lecture 10: Boolean Expressions / 1

12 Interval example MIN COMFY TEMP = 12 MAX COMFY TEMP = 25 if (MIN COMFY TEMP <= temp) and (temp <= MAX COMFY TEMP): print ( Comfortable ) else : print ( Uncomfortable ) 1 1 Python allows three-way test. Will see this later. KH (12/10/17) Lecture 10: Boolean Expressions / 1

13 Short circuit principle Notice that if X is False, then X and Y will be False regardless of the value of Y. X Y X and Y False False False False True False True False False True True True For composite conditions using and, Python won t evaluate the second part if the first is False if (num days > 0) and ( total rainfall /num days >= 20): print( It was lashing ) This short circuiting avoids the division in the case when num days is zero KH (12/10/17) Lecture 10: Boolean Expressions / 1

14 Other Boolean operators and X Y X and Y False False False False True False True False False True True True or X Y X or Y False False False False True True True False True True True True Result True if both operands are True Short circuit: Y only evaluated if X is True X False True not X True False not Inverts value of operand Result True if either operands is True (or both) Short circuit: Y only evaluated if X is False KH (12/10/17) Lecture 10: Boolean Expressions / 1

15 Boolean expressions True or False not not False False and (True or False) True and not (False or True) ( False and True) or False (not (True and False)) or ( False or not True) KH (12/10/17) Lecture 10: Boolean Expressions / 1

16 Precedence among operators (partial) ** Exponentiations High *, /, //, % Arithmetic multiplicative operators +, - Addition and subtraction <, <=, >, >=, ==,!= Comparative operators not not and and or or Low KH (12/10/17) Lecture 10: Boolean Expressions / 1

17 Precedence among operators (partial) ** Exponentiations High *, /, //, % Arithmetic multiplicative operators +, - Addition and subtraction <, <=, >, >=, ==,!= Comparative operators not not and and or or Low True or True and False True KH (12/10/17) Lecture 10: Boolean Expressions / 1

18 More examples False and True or False ( False and True) or False not False and True (not False) and True not True and False (not True) and False x < 17 and y!= 3 (x < 17) and (y!= 3) KH (12/10/17) Lecture 10: Boolean Expressions / 1

19 Age example Task Compute age based on today s date and data of birth Assume Dates available in day-month-year format Idea Need to establish whether individual s birthday has occurred yet this year KH (12/10/17) Lecture 10: Boolean Expressions / 1

20 Solution def get today (): # Return today's date in day, month, year format... def get dob(): # Read user date of birth and return result in day, # month, year format... today day, today month, today year = get today() dob day, dob month, dob year = get dob() had birthday = (dob month < today month) \ or (dob month == today month)\ and (dob day <= today day) KH (12/10/17) Lecture 10: Boolean Expressions / 1

21 Solution cont d if had birthday : age = today year dob year else : age = today year dob year 1 print( Age is, age) KH (12/10/17) Lecture 10: Boolean Expressions / 1

22 Leap year example Task Write Python function to determine if a year is a leap year or not Leap years? Leap years are divisible by 4 but not by 100 unless the year is divisible by 400 Examples KH (12/10/17) Lecture 10: Boolean Expressions / 1

23 Leap year example Task Write Python function to determine if a year is a leap year or not Leap years? Leap years are divisible by 4 but not by 100 unless the year is divisible by 400 Examples Leap 2016 Non-Leap 2013, 2014, 2015 KH (12/10/17) Lecture 10: Boolean Expressions / 1

24 Leap year example Task Write Python function to determine if a year is a leap year or not Leap years? Leap years are divisible by 4 but not by 100 unless the year is divisible by 400 Examples Leap 2016, 2000 Non-Leap 2013, 2014, 2015, 1800, 1900, 2100 KH (12/10/17) Lecture 10: Boolean Expressions / 1

25 Solution def is leap (year ): # Return True if specified year is a leap year divby 4 = year % 4 == 0 divby 100 = year % 100 == 0 divby 400 = year % 400 == 0 return divby 4 and (not divby 100 or divby 400) KH (12/10/17) Lecture 10: Boolean Expressions / 1

26 Days in the month Task Write Python function to determine the number of days in a particular month Thirty days hath...? KH (12/10/17) Lecture 10: Boolean Expressions / 1

27 Days in the month Task Write Python function to determine the number of days in a particular month Thirty days hath...? Thirty days have September, April, June, and November. All the rest have 31, Except February alone, And that has 28 days clear, And 29 in a leap year. KH (12/10/17) Lecture 10: Boolean Expressions / 1

28 Solution JAN, FEB, MAR, APR = 1, 2, 3, 4 MAY, JUN, JUL, AUG = 5, 6, 7, 8 SEP, OCT, NOV, DEC = 9, 10, 11, def num days(month, year): # Return number of days in the specified month thirty days = (month == SEP) or (month == APR)\ or (month == JUN) or (month == NOV) thirty one days = not thirty days and not (month == FEB) if thirty days: return 30 elif thirty one days : return 31 elif is leap (year ): return 29 else : return 28 KH (12/10/17) Lecture 10: Boolean Expressions / 1

29 Back Material Notes and Acknowledgements Reading Code Acknowledgements KH (12/10/17) Lecture 10: Boolean Expressions / 1

Lecture 3: More SQL Basics CS1106/CS5021/CS6503 Introduction to Relational Databases. Single-Criterion WHERE Conditions. SQL Conditions.

Lecture 3: More SQL Basics CS1106/CS5021/CS6503 Introduction to Relational Databases. Single-Criterion WHERE Conditions. SQL Conditions. Lecture 3: More SQL Basics CS1106/CS5021/CS6503 Introduction to Relational Databases Dr Kieran T. Herley Summary Composite conditions using AND, OR and NOT. The IN operator. Ordering results. Renaming

More information

Lecture 3: More SQL Basics

Lecture 3: More SQL Basics Lecture 3: More SQL Basics CS1106/CS5021/CS6503 Introduction to Relational Databases Dr Kieran T. Herley Department of Computer Science University College Cork 2018/19 KH (11/09/18) Lecture 3: More SQL

More information

Excel Functions & Tables

Excel Functions & Tables Excel Functions & Tables SPRING 2016 Spring 2016 CS130 - EXCEL FUNCTIONS & TABLES 1 Review of Functions Quick Mathematics Review As it turns out, some of the most important mathematics for this course

More information

Conditional Expressions and Decision Statements

Conditional Expressions and Decision Statements Conditional Expressions and Decision Statements June 1, 2015 Brian A. Malloy Slide 1 of 23 1. We have introduced 5 operators for addition, subtraction, multiplication, division, and exponentiation: +,

More information

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

Lecture 11: while loops CS1068+ Introductory Programming in Python. for loop revisited. while loop. Summary. Dr Kieran T. Herley Lecture 11: while loops CS1068+ Introductory Programming in Python Dr Kieran T. Herley Python s while loop. Summary Department of Computer Science University College Cork 2017-2018 KH (24/10/17) Lecture

More information

3. EXCEL FORMULAS & TABLES

3. EXCEL FORMULAS & TABLES Winter 2019 CS130 - Excel Formulas & Tables 1 3. EXCEL FORMULAS & TABLES Winter 2019 Winter 2019 CS130 - Excel Formulas & Tables 2 Cell References Absolute reference - refer to cells by their fixed position.

More information

INFORMATION TECHNOLOGY SPREADSHEETS. Part 1

INFORMATION TECHNOLOGY SPREADSHEETS. Part 1 INFORMATION TECHNOLOGY SPREADSHEETS Part 1 Page: 1 Created by John Martin Exercise Built-In Lists 1. Start Excel Spreadsheet 2. In cell B1 enter Mon 3. In cell C1 enter Tue 4. Select cell C1 5. At the

More information

Grade 4 Mathematics Pacing Guide

Grade 4 Mathematics Pacing Guide Jul 2014 ~ August 2014 ~ Sep 2014 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 Routines 19 Routines 20 Routines BOY 22 BOY 23 24 11 12 14 29 15 30 31 Notes: Found Online @ wwweverydaymathonlinecom 1 More Calendars

More information

Lecture 2: Python Arithmetic

Lecture 2: Python Arithmetic Lecture 2: Python Arithmetic CS1068+ Introductory Programming in Python Dr Kieran T. Herley 2018/19 Department of Computer Science University College Cork Basic data types in Python Python data types Programs

More information

PRG PROGRAMMING ESSENTIALS. Lecture 2 Program flow, Conditionals, Loops

PRG PROGRAMMING ESSENTIALS. Lecture 2 Program flow, Conditionals, Loops PRG PROGRAMMING ESSENTIALS 1 Lecture 2 Program flow, Conditionals, Loops https://cw.fel.cvut.cz/wiki/courses/be5b33prg/start Michal Reinštein Czech Technical University in Prague, Faculty of Electrical

More information

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation CS113: Lecture 3 Topics: Variables Data types Arithmetic and Bitwise Operators Order of Evaluation 1 Variables Names of variables: Composed of letters, digits, and the underscore ( ) character. (NO spaces;

More information

DATE OF BIRTH SORTING (DBSORT)

DATE OF BIRTH SORTING (DBSORT) DATE OF BIRTH SORTING (DBSORT) Release 3.1 December 1997 - ii - DBSORT Table of Contents 1 Changes Since Last Release... 1 2 Purpose... 3 3 Limitations... 5 3.1 Command Line Parameters... 5 4 Input...

More information

AIMMS Function Reference - Date Time Related Identifiers

AIMMS Function Reference - Date Time Related Identifiers AIMMS Function Reference - Date Time Related Identifiers This file contains only one chapter of the book. For a free download of the complete book in pdf format, please visit www.aimms.com Aimms 3.13 Date-Time

More information

CIMA Asia. Interactive Timetable Live Online

CIMA Asia. Interactive Timetable Live Online CIMA Asia Interactive Timetable 2017 2018 Live Online Version 1 Information last updated 09 October 2017 Please note: Information and dates in this timetable are subject to change. CIMA Cert BA Course

More information

software.sci.utah.edu (Select Visitors)

software.sci.utah.edu (Select Visitors) software.sci.utah.edu (Select Visitors) Web Log Analysis Yearly Report 2002 Report Range: 02/01/2002 00:00:0-12/31/2002 23:59:59 www.webtrends.com Table of Contents Top Visitors...3 Top Visitors Over Time...5

More information

CSE 341 Section Handout #6 Cheat Sheet

CSE 341 Section Handout #6 Cheat Sheet Cheat Sheet Types numbers: integers (3, 802), reals (3.4), rationals (3/4), complex (2+3.4i) symbols: x, y, hello, r2d2 booleans: #t, #f strings: "hello", "how are you?" lists: (list 3 4 5) (list 98.5

More information

Undergraduate Admission File

Undergraduate Admission File Undergraduate Admission File June 13, 2007 Information Resources and Communications Office of the President University of California Overview Population The Undergraduate Admission File contains data on

More information

Operator overloading: extra examples

Operator overloading: extra examples Operator overloading: extra examples CS319: Scientific Computing (with C++) Niall Madden Week 8: some extra examples, to supplement what was covered in class 1 Eg 1: Points in the (x, y)-plane Overloading

More information

CIMA Asia. Interactive Timetable Live Online

CIMA Asia. Interactive Timetable Live Online CIMA Asia Interactive Timetable 2018 Live Online Information version 8 last updated 04/05/18 Please note information and dates are subject to change. Premium Learning Partner 2018 CIMA Cert BA Course Overview

More information

Freedom of Information Act 2000 reference number RFI

Freedom of Information Act 2000 reference number RFI P. Norris By email to: xxxxxxxxxxxxxxxxxxxxxx@xxxxxxxxxxxxxx.xxm 02 November 2011 Dear P. Norris Freedom of Information Act 2000 reference number RFI20111218 Thank you for your request under the Freedom

More information

ECSE 321 Assignment 2

ECSE 321 Assignment 2 ECSE 321 Assignment 2 Instructions: This assignment is worth a total of 40 marks. The assignment is due by noon (12pm) on Friday, April 5th 2013. The preferred method of submission is to submit a written

More information

This report is based on sampled data. Jun 1 Jul 6 Aug 10 Sep 14 Oct 19 Nov 23 Dec 28 Feb 1 Mar 8 Apr 12 May 17 Ju

This report is based on sampled data. Jun 1 Jul 6 Aug 10 Sep 14 Oct 19 Nov 23 Dec 28 Feb 1 Mar 8 Apr 12 May 17 Ju 0 - Total Traffic Content View Query This report is based on sampled data. Jun 1, 2009 - Jun 25, 2010 Comparing to: Site 300 Unique Pageviews 300 150 150 0 0 Jun 1 Jul 6 Aug 10 Sep 14 Oct 19 Nov 23 Dec

More information

CS Programming I: Arrays

CS Programming I: Arrays CS 200 - Programming I: Arrays Marc Renault Department of Computer Sciences University of Wisconsin Madison Fall 2017 TopHat Sec 3 (PM) Join Code: 719946 TopHat Sec 4 (AM) Join Code: 891624 Array Basics

More information

Lecture 15: Dictionaries

Lecture 15: Dictionaries Lecture 15: Dictionaries CS1068+ Introductory Programming in Python Dr Kieran T. Herley 2018/19 Department of Computer Science University College Cork Summary Python s dictionary concept. 1 Dictionaries

More information

Lecture 8: Simple Calculator Application

Lecture 8: Simple Calculator Application Lecture 8: Simple Calculator Application Postfix Calculator Dr Kieran T. Herley Department of Computer Science University College Cork 2016/17 KH (27/02/17) Lecture 8: Simple Calculator Application 2016/17

More information

Conditionals. CSE / ENGR 142 Programming I. Chapter 4. Conditional Execution. Conditional ("if ") Statement. Conditional Expressions

Conditionals. CSE / ENGR 142 Programming I. Chapter 4. Conditional Execution. Conditional (if ) Statement. Conditional Expressions 1999 UW CSE CSE / ENGR 142 Programming I Conditionals Chapter 4 Read Sections 4.1-4.5, 4.7-4.9 4.1: Control structure preview 4.2: Relational and logical operators 4.3: if statements 4.4: Compound statements

More information

Lecture 6. Drinking. Nested if. Nested if s reprise. The boolean data type. More complex selection statements: switch. Examples.

Lecture 6. Drinking. Nested if. Nested if s reprise. The boolean data type. More complex selection statements: switch. Examples. // Simple program to show how an if- statement works. import java.io.*; Lecture 6 class If { static BufferedReader keyboard = new BufferedReader ( new InputStreamReader( System.in)); public static void

More information

Flow Control. So Far: Writing simple statements that get executed one after another.

Flow Control. So Far: Writing simple statements that get executed one after another. Flow Control So Far: Writing simple statements that get executed one after another. Flow Control So Far: Writing simple statements that get executed one after another. Flow control allows the programmer

More information

Section 1.2: What is a Function? y = 4x

Section 1.2: What is a Function? y = 4x Section 1.2: What is a Function? y = 4x y is the dependent variable because it depends on what x is. x is the independent variable because any value can be chosen to replace x. Domain: a set of values

More information

Definition: Data Type A data type is a collection of values and the definition of one or more operations on those values.

Definition: Data Type A data type is a collection of values and the definition of one or more operations on those values. Data Types 1 Definition: Data Type A data type is a collection of values and the definition of one or more operations on those values. Base Data Types All the values of the type are ordered and atomic.

More information

Lecture 4: Basic I/O

Lecture 4: Basic I/O Lecture 4: Basic I/O CS1068+ Introductory Programming in Python Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (21/09/17) Lecture 4: Basic I/O 2017-2018 1 / 20

More information

Programming, Problem Solving, and Abstraction. Chapter Three. Selection

Programming, Problem Solving, and Abstraction. Chapter Three. Selection Programming, Problem Solving, and Abstraction Chapter Three Selection c The University of Melbourne, 2018 Lecture slides prepared by Alistair Moffat Chapter 3 to watch for 3.5 The switch statement Chapter

More information

Types, Operators and Expressions

Types, Operators and Expressions Types, Operators and Expressions EECS 2031 18 September 2017 1 Variable Names (2.1) l Combinations of letters, numbers, and underscore character ( _ ) that do not start with a number; are not a keyword.

More information

HPE Security Data Security. HPE SecureData. Product Lifecycle Status. End of Support Dates. Date: April 20, 2017 Version:

HPE Security Data Security. HPE SecureData. Product Lifecycle Status. End of Support Dates. Date: April 20, 2017 Version: HPE Security Data Security HPE SecureData Product Lifecycle Status End of Support Dates Date: April 20, 2017 Version: 1704-1 Table of Contents Table of Contents... 2 Introduction... 3 HPE SecureData Appliance...

More information

Introduction to Computer Programming for Non-Majors

Introduction to Computer Programming for Non-Majors Introduction to Computer Programming for Non-Majors CSC 2301, Fall 2015 Chapter 5 Part 1 The Department of Computer Science Objectives To understand the string data type and how strings are represented

More information

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2. Class #10: Understanding Primitives and Assignments Software Design I (CS 120): M. Allen, 19 Sep. 18 Java Arithmetic } Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = 2 + 5 / 2; 3.

More information

CS 115 Data Types and Arithmetic; Testing. Taken from notes by Dr. Neil Moore

CS 115 Data Types and Arithmetic; Testing. Taken from notes by Dr. Neil Moore CS 115 Data Types and Arithmetic; Testing Taken from notes by Dr. Neil Moore Statements A statement is the smallest unit of code that can be executed on its own. So far we ve seen simple statements: Assignment:

More information

SCI - software.sci.utah.edu (Select Visitors)

SCI - software.sci.utah.edu (Select Visitors) SCI - software.sci.utah.edu (Select Visitors) Web Log Analysis Yearly Report 2004 Report Range: 01/01/2004 00:00:00-12/31/2004 23:59:59 www.webtrends.com Table of Contents Top Visitors...3 Top Visitors

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

Banner 9 Overview and Transition timeline August Edgar Coronel Paddy Wong

Banner 9 Overview and Transition timeline August Edgar Coronel Paddy Wong Banner 9 Overview and Transition timeline August 2018 Edgar Coronel Paddy Wong v1 Banner Basics Banner 9 Overview Single Sign On Begin Transition! Using Banner 9 Demo Agenda Banner Basics Banner Forms

More information

CS Boolean Statements and Decision Structures. Week 6

CS Boolean Statements and Decision Structures. Week 6 CS 17700 Boolean Statements and Decision Structures Week 6 1 Announcements Midterm 1 is on Feb 19 th, 8:00-9:00 PM in PHYS 114 and PHYS 112 Let us know in advance about conflicts or other valid makeup

More information

Lecture 2: Writing Your Own Class Definition

Lecture 2: Writing Your Own Class Definition Lecture 2: Writing Your Own Class Definition CS6507 Python Programming and Data Science Applications Dr Kieran T. Herley 2017-2018 Department of Computer Science University College Cork Summary Writing

More information

COURSE LISTING. Courses Listed. Training for Database & Technology with Modeling in SAP HANA. 20 November 2017 (12:10 GMT) Beginner.

COURSE LISTING. Courses Listed. Training for Database & Technology with Modeling in SAP HANA. 20 November 2017 (12:10 GMT) Beginner. Training for Database & Technology with Modeling in SAP HANA Courses Listed Beginner HA100 - SAP HANA Introduction Advanced HA300 - SAP HANA Certification Exam C_HANAIMP_13 - SAP Certified Application

More information

YTD OCT NOV DEC JAN FEB MAR APR MAY JUN JUL AUG SEP TOTAL

YTD OCT NOV DEC JAN FEB MAR APR MAY JUN JUL AUG SEP TOTAL ~ FISCAL YEAR ~ 2016 2017 % change ~ CALENDAR YEAR ~ 2015 2016 % change YTD OCT NOV DEC JAN FEB MAR APR MAY JUN JUL AUG SEP TOTAL 118,547 39,549 37,870 41,128 46,011 47,281 r 37,317 35,394 35,466 r 41,502

More information

OCT NOV DEC JAN FEB MAR APR MAY JUN JUL AUG SEP JAPAN MS YTD TOTAL

OCT NOV DEC JAN FEB MAR APR MAY JUN JUL AUG SEP JAPAN MS YTD TOTAL ~ FISCAL YEAR ~ 2015 2016 % change ~ CALENDAR YEAR ~ 2015 2016 % change YTD OCT NOV DEC JAN FEB MAR APR MAY JUN JUL AUG SEP TOTAL 369,552 35,587 39,137 44,910 45,688 42,921 42,539 40,473 39,955 r 38,342

More information

Strings, Lists, and Sequences

Strings, Lists, and Sequences Strings, Lists, and Sequences It turns out that strings are really a special kind of sequence, so these operations also apply to sequences! >>> [1,2] + [3,4] [1, 2, 3, 4] >>> [1,2]*3 [1, 2, 1, 2, 1, 2]

More information

CS100: CPADS. Decisions. David Babcock / Don Hake Department of Physical Sciences York College of Pennsylvania

CS100: CPADS. Decisions. David Babcock / Don Hake Department of Physical Sciences York College of Pennsylvania CS100: CPADS Decisions David Babcock / Don Hake Department of Physical Sciences York College of Pennsylvania James Moscola Decisions Just like a human, programs need to make decisions - Should turtle turn

More information

ENGR 101 Engineering Design Workshop

ENGR 101 Engineering Design Workshop ENGR 101 Engineering Design Workshop Lecture 2: Variables, Statements/Expressions, if-else Edgardo Molina City College of New York Literals, Variables, Data Types, Statements and Expressions Python as

More information

Introduction. Structures, Unions, Bit Manipulations, and Enumerations. Structure. Structure Definitions

Introduction. Structures, Unions, Bit Manipulations, and Enumerations. Structure. Structure Definitions Introduction Structures, Unions, Bit Manipulations, and Enumerations In C, we can create our own data types If programmers do a good job of this, the end user does not even have to know what is in the

More information

All King County Summary Report

All King County Summary Report September, 2016 MTD MARKET UPDATE Data Current Through: September, 2016 18,000 16,000 14,000 12,000 10,000 8,000 6,000 4,000 2,000 0 Active, Pending, & Months Supply of Inventory 15,438 14,537 6.6 6.7

More information

CA341 - Comparative Programming Languages

CA341 - Comparative Programming Languages CA341 - Comparative Programming Languages and David Sinclair Data, Values and Types In 1976 Niklaus Wirth (inventor of Pascal, Modula, Oberon, etc) wrote a book called Algorithms + Data Structures = Programs

More information

Lecture 0: Overview of cs1106/cs6503

Lecture 0: Overview of cs1106/cs6503 Lecture 0: Overview of cs1106/cs6503 cs1106+ Overview Dr Kieran T. Herley Department of Computer Science University College Cork 2018/19 KH (09/10/18) Lecture 0: Overview of cs1106/cs6503 2018/19 1 / 16

More information

CSE 142 Programming I

CSE 142 Programming I CSE 142 Programming I Conditionals Chapter 4 lread Sections 4.1 4.5, 4.7 4.9 lthe book assumes that you ve read chapter 3 on functions Read it anyway, you should do fine Their order is a little screwy...

More information

Exam 2 ITEC 120 Principles of Computer Science I Spring: 2017

Exam 2 ITEC 120 Principles of Computer Science I Spring: 2017 Exam 2 ITEC 120 Principles of Computer Science I Spring: 2017 I will abide by the Radford University Honor Code. Name Signature On this exam, you may NOT use already written methods such as Character class

More information

CS2 Current Technologies Lecture 2: SQL Programming Basics

CS2 Current Technologies Lecture 2: SQL Programming Basics T E H U N I V E R S I T Y O H F R G E D I N B U CS2 Current Technologies Lecture 2: SQL Programming Basics Dr Chris Walton (cdw@dcs.ed.ac.uk) 4 February 2002 The SQL Language 1 Structured Query Language

More information

CIMA Certificate BA Interactive Timetable

CIMA Certificate BA Interactive Timetable CIMA Certificate BA Interactive Timetable 2018 Nottingham & Leicester Version 3.2 Information last updated 09/03/18 Please note: Information and dates in this timetable are subject to change. Introduction

More information

ACTIVE MICROSOFT CERTIFICATIONS:

ACTIVE MICROSOFT CERTIFICATIONS: Last Activity Recorded : August 03, 2017 Microsoft Certification ID : 2069071 JESSE WIMBERLEY 5421 33RD CT SE LACEY, Washington 98503 US jesse.wimberley@gmail.com ACTIVE MICROSOFT CERTIFICATIONS: Microsoft

More information

Seattle (NWMLS Areas: 140, 380, 385, 390, 700, 701, 705, 710) Summary

Seattle (NWMLS Areas: 140, 380, 385, 390, 700, 701, 705, 710) Summary September, 2016 MTD MARKET UPDATE Data Current Through: September, 2016 (NWMLS Areas: 140, 380, 385, 390,, 701, 705, 710) Summary Active, Pending, & Months Supply of Inventory 5,000 4,500 4,000 3,500 4,091

More information

Asks for clarification of whether a GOP must communicate to a TOP that a generator is in manual mode (no AVR) during start up or shut down.

Asks for clarification of whether a GOP must communicate to a TOP that a generator is in manual mode (no AVR) during start up or shut down. # Name Duration 1 Project 2011-INT-02 Interpretation of VAR-002 for Constellation Power Gen 185 days Jan Feb Mar Apr May Jun Jul Aug Sep O 2012 2 Start Date for this Plan 0 days 3 A - ASSEMBLE SDT 6 days

More information

Types, Operators and Expressions

Types, Operators and Expressions Types, Operators and Expressions CSE 2031 Fall 2011 9/11/2011 5:24 PM 1 Variable Names (2.1) Combinations of letters, numbers, and underscore character ( _ ) that do not start with a number; are not a

More information

1.8 Intro to Variables, Algebraic Expressions, and Equations

1.8 Intro to Variables, Algebraic Expressions, and Equations 1.8 Intro to Variables, Algebraic Expressions, and Equations Professor Tim Busken M.S. Applied Mathematics with a Concentration in Dynamical Systems San Diego State University 2011 Southwestern College

More information

New Concept for Article 36 Networking and Management of the List

New Concept for Article 36 Networking and Management of the List New Concept for Article 36 Networking and Management of the List Kerstin Gross-Helmert, AFSCO 28 th Meeting of the Focal Point Network EFSA, MTG SEAT 00/M08-09 THE PRESENTATION Why a new concept? What

More information

2

2 February 2015 1 2 3 4 5 A. Consumer Confidence Index (CCI) - Consumer Confidence Index (CCI) - Current Economic Condition Index (CECI) - Consumer Expectation Index (CEI) Current Economic Condition Index

More information

CS 115 Lecture 8. Selection: the if statement. Neil Moore

CS 115 Lecture 8. Selection: the if statement. Neil Moore CS 115 Lecture 8 Selection: the if statement Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 24 September 2015 Selection Sometime we want to execute

More information

Seattle (NWMLS Areas: 140, 380, 385, 390, 700, 701, 705, 710) Summary

Seattle (NWMLS Areas: 140, 380, 385, 390, 700, 701, 705, 710) Summary November, 2016 MTD MARKET UPDATE Data Current Through: November, 2016 (NWMLS Areas: 140, 380, 385, 390,, 701, 705, 710) Summary 4,000 3,500 3,000 2,500 2,000 1,500 1,000 500 0 Active, Pending, & Months

More information

Characterization and Modeling of Deleted Questions on Stack Overflow

Characterization and Modeling of Deleted Questions on Stack Overflow Characterization and Modeling of Deleted Questions on Stack Overflow Denzil Correa, Ashish Sureka http://correa.in/ February 16, 2014 Denzil Correa, Ashish Sureka (http://correa.in/) ACM WWW-2014 February

More information

Boolean Algebra A B A AND B = A*B A B A OR B = A+B

Boolean Algebra A B A AND B = A*B A B A OR B = A+B Boolean Algebra Algebra is the branch of mathematics that deals with variables. Variables represent unknown values and usually can stand for any real number. Because computers use only 2 numbers as we

More information

Selection Statement ( if )

Selection Statement ( if ) Islamic University Of Gaza Faculty of Engineering Computer Engineering Department Lab 4 Selection Statement ( if ) Eng. Ibraheem Lubbad October 10, 2016 In this lab we will constructs program that allow

More information

If Case Loop Next Exit

If Case Loop Next Exit If Case Loop Next Exit If statement If_statement ::= if condition then sequence of sequential statements {elsif condition then sequence of sequential statements} [else sequence of sequential 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

UEE1302(1102) F10: Introduction to Computers and Programming

UEE1302(1102) F10: Introduction to Computers and Programming Computational Intelligence on Automation Lab @ NCTU UEE1302(1102) F10: Introduction to Computers and Programming Programming Lecture 02 Flow of Control (I): Boolean Expression and Selection Learning Objectives

More information

61A Lecture 3. Friday, September 5

61A Lecture 3. Friday, September 5 61A Lecture 3 Friday, September 5 Announcements There's plenty of room in live lecture if you want to come (but videos are still better) Please don't make noise outside of the previous lecture! Homework

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

September Real Sector Statistics Division. Methodology

September Real Sector Statistics Division. Methodology September 2014 Methodology The Consumer Survey has been conducted monthly since October 1999. Moreover, since January 2007 the Survey has involved 4,600 households as respondents (stratified random sampling)

More information

YTD Check Register CALDWELL ISD Sort by Check Number

YTD Check Register CALDWELL ISD Sort by Check Number YTD Register Sort by Number Page 1 of 120 000144 09-16-2015 00426 SHERRY L EDWARDS 199-00-2159.00-112-600000 D SEP WIRE MISCELLANEOUS 376.00 N 000145 09-16-2015 01442 TEXAS CHILD SUPPOR 199-00-2159.00-107-600000

More information

Dictionaries. Looking up English words in the dictionary. Python sequences and collections. Properties of sequences and collections

Dictionaries. Looking up English words in the dictionary. Python sequences and collections. Properties of sequences and collections Looking up English words in the dictionary Comparing sequences to collections. Sequence : a group of things that come one after the other Collection : a group of (interesting) things brought together for

More information

Nigerian Telecommunications Sector

Nigerian Telecommunications Sector Nigerian Telecommunications Sector SUMMARY REPORT: Q4 and full year 2015 NATIONAL BUREAU OF STATISTICS 26th April 2016 Telecommunications Data The telecommunications data used in this report were obtained

More information

NMOSE GPCD CALCULATOR

NMOSE GPCD CALCULATOR NMOSE CALCULATOR It should be noted that all the recorded data should be from actual metered results and should not include any estimates. Gallons per Capita - v2.4 Beta Release Date: Mar, 16, 29 This

More information

Arrays: The How and the Why of it All Jane Stroupe

Arrays: The How and the Why of it All Jane Stroupe Arrays: The How and the Why of it All Jane Stroupe When you need to join data sets, do you even ask yourself Why don t I just use an array? Perhaps because arrays are a mystery or perhaps because you have

More information

More Binary Search Trees AVL Trees. CS300 Data Structures (Fall 2013)

More Binary Search Trees AVL Trees. CS300 Data Structures (Fall 2013) More Binary Search Trees AVL Trees bstdelete if (key not found) return else if (either subtree is empty) { delete the node replacing the parents link with the ptr to the nonempty subtree or NULL if both

More information

Conditions, logical expressions, and selection. Introduction to control structures

Conditions, logical expressions, and selection. Introduction to control structures Conditions, logical expressions, and selection Introduction to control structures Flow of control In a program, statements execute in a particular order By default, statements are executed sequentially:

More information

MISO PJM Joint and Common Market Cross Border Transmission Planning

MISO PJM Joint and Common Market Cross Border Transmission Planning MISO PJM Joint and Common Market Cross Border Transmission Planning May 30, 2018 1 Coordinated System Plan Study 2 Using information from the March 30 Annual Issues Review, the JRPC has decided to perform

More information

FREQUENTLY ASKED QUESTIONS

FREQUENTLY ASKED QUESTIONS DISTRICT 7030 WEBSITE FREQUENTLY ASKED QUESTIONS NB: THIS WILL BE REGULARLY UPDATED FOR YOUR INFORMATION. 1. This website works better with the following browsers: Internet Explorer (IE) and Google Chrome.

More information

C Structures, Unions, Bit Manipulations, and Enumerations

C Structures, Unions, Bit Manipulations, and Enumerations C Structures, Unions, Bit Manipulations, and Enumerations Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline 10.2 Structure Definitions 10.4

More information

Booleans, Logical Expressions, and Predicates

Booleans, Logical Expressions, and Predicates Making Decisions Real-life examples for decision making with Boolean values., Logical Expressions, and Predicates If it s raining then bring umbrella and wear boots. CS111 Computer Programming Department

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

Type Definition. C Types. Derived. Function Array Pointer Structure Union Enumerated. EE 1910 Winter 2017/18

Type Definition. C Types. Derived. Function Array Pointer Structure Union Enumerated. EE 1910 Winter 2017/18 Enum and Struct Type Definition C Types Derived Function Array Pointer Structure Union Enumerated 2 tj Type Definition Typedef Define a new Type Inherits members and operations from a standard or previously

More information

Questions? Static Semantics. Static Semantics. Static Semantics. Next week on Wednesday (5 th of October) no

Questions? Static Semantics. Static Semantics. Static Semantics. Next week on Wednesday (5 th of October) no Questions? First exercise is online: http://www.win.tue.nl/~mvdbrand/courses/glt/1112/ Deadline 17 th of October Next week on Wednesday (5 th of October) no lectures!!! Primitive types Primitive value

More information

More BSTs & AVL Trees bstdelete

More BSTs & AVL Trees bstdelete More BSTs & AVL Trees bstdelete if (key not found) return else if (either subtree is empty) { delete the node replacing the parents link with the ptr to the nonempty subtree or NULL if both subtrees are

More information

Polycom Advantage Service Endpoint Utilization Report

Polycom Advantage Service Endpoint Utilization Report Polycom Advantage Service Endpoint Utilization Report ABC Company 9/1/2018-9/30/2018 Polycom, Inc. All rights reserved. SAMPLE REPORT d This report is for demonstration purposes only. Any resemblance to

More information

Polycom Advantage Service Endpoint Utilization Report

Polycom Advantage Service Endpoint Utilization Report Polycom Advantage Service Endpoint Utilization Report ABC Company 3/1/2016-3/31/2016 Polycom, Inc. All rights reserved. SAMPLE REPORT d This report is for demonstration purposes only. Any resemblance to

More information

Genome 559 Intro to Statistical and Computational Genomics Lecture 16b: Classes and Objects, III Larry Ruzzo

Genome 559 Intro to Statistical and Computational Genomics Lecture 16b: Classes and Objects, III Larry Ruzzo Genome 559 Intro to Statistical and Computational Genomics 2009 Lecture 16b: Classes and Objects, III Larry Ruzzo 1 Continuing Date example class Date: def init (self, day, month) : self.myday = day self.mymonth

More information

ICT PROFESSIONAL MICROSOFT OFFICE SCHEDULE MIDRAND

ICT PROFESSIONAL MICROSOFT OFFICE SCHEDULE MIDRAND ICT PROFESSIONAL MICROSOFT OFFICE SCHEDULE MIDRAND BYTES PEOPLE SOLUTIONS Bytes Business Park 241 3rd Road Halfway Gardens Midrand Tel: +27 (11) 205-7000 Fax: +27 (11) 205-7110 Email: gauteng.sales@bytes.co.za

More information

Mainline Functional Testing Techniques

Mainline Functional Testing Techniques Mainline Functional Testing Techniques (4 flavors) Equivalence Partitions (another 4 flavors) Special Value Testing Output Domain (Range) Checking Decision Table Based Testing (aka Cause and Effect Graphs

More information

Introduction to Python and Programming. 1. Python is Like a Calculator. You Type Expressions. Python Computes Their Values /2 2**3 3*4+5*6

Introduction to Python and Programming. 1. Python is Like a Calculator. You Type Expressions. Python Computes Their Values /2 2**3 3*4+5*6 1. Python is a calculator. A variable is a container Introduction to Python and Programming BBM 101 - Introduction to Programming I Hacettepe University Fall 016 Fuat Akal, Aykut Erdem, Erkut Erdem 3.

More information

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output? Arithmetic Operators Section 2.15 & 3.2 p 60-63, 81-89 1 Today Arithmetic Operators & Expressions o Computation o Precedence o Associativity o Algebra vs C++ o Exponents 2 Assigning floats to ints int

More information

Yield Reduction Due to Shading:

Yield Reduction Due to Shading: Soap Factory, 111 Gallowgate, Aberdeen, AB5 1 B U 07768 30451/014 9 0 0 8 7 8 3x0 00 x x JT50SCc 50 W TRIO-0,0-TL-OUT x0 3x0 x TRIO-0,0-TL-OUT 3; 1 0.0kW 00 x x JT50SCc 50 W TRIO-0,0-TL-OUT 0.0kW 00 x

More information

Essentials. Week by. Week. All About Data. Algebra Alley

Essentials. Week by. Week. All About Data. Algebra Alley > Week by Week MATHEMATICS Essentials Algebra Alley Jack has 0 nickels and some quarters. If the value of the coins is $.00, how many quarters does he have? (.0) What s The Problem? Pebble Pebble! A pebble

More information

CS1101: Lecture 9 The Shell as a Programming Language

CS1101: Lecture 9 The Shell as a Programming Language CS1101: Lecture 9 The Shell as a Programming Language Dr. Barry O Sullivan b.osullivan@cs.ucc.ie Counting Arguments Using read Lecture Outline Arithmetic using expr Course Homepage http://www.cs.ucc.ie/

More information

ASSOCIATION OF CHARTERED CERTIFIED ACCOUNTANTS

ASSOCIATION OF CHARTERED CERTIFIED ACCOUNTANTS E CENT R LI CB E NSE D CE 1 April 2017 31 March 2018 ASSOCIATION OF CHARTERED CERTIFIED ACCOUNTANTS THE BRITISH COUNCIL IN UAE ADMINISTERS COMPUTER BASED EXAMS ON BEHALF OF ACCA www.britishcouncil.ae LIC

More information