PYTHON PROGRAMMING Week 14 – Tuesday. STARTER You need to find out the average of a set of exam marks for a class. You don’t know how many marks there.

Slides:



Advertisements
Similar presentations
Senem Kumova Metin CHAPTER 7 Bitwise Operators and Enumeration Types.
Advertisements

CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Professor Jennifer Rexford COS 217
Binary numbers. 1 Humans count using decimal numbers (base 10) We use 10 units: 0, 1, 2, 3, 4, 5, 6, 7, 8 and (5.
Binary Conversion In today’s lesson we will link together the binary and algorithm topics by looking at how to get the computer to: convert binary to decimal.
PYTHON PROGRAMMING Week 9 - Wednesday. WRITE A PROGRAM TO:  print all the numbers from 1 to 100  print all the even numbers from 1 to 100  print all.
PYTHON PROGRAMMING Week 10 – Wednesday. TERMS – CHAPTER 1 Write down definitions for these terms:  Computation  Computability  Computing  Artificial.
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
Lecture 2: Operations Bryan Burlingame 9Sept2015.
PYTHON PROGRAMING Week 15 – Tuesday.
Bitwise operators. Representing integers We typically think in terms of decimal (base 10) numbers.  Why?  A decimal (or base 10) number consists of.
Operations on Bits Arithmetic Operations Logic Operations
PYTHON PROGRAMMING Week 6 - Tuesday. WHAT’S AN ALGORITHM?
Hexadecimal Data Representation. Objectives  Know how the Hexadecimal counting system works  Be able to convert between denary, binary & hexadecimal.
Data Representation Hexadecimal  Although computers work in binary it is sometimes inconvenient for humans to read everything in Binary. For example in.
Number Bases and Representation. Denary Number System (Base 10) Our number system uses 10 digits (0-9) As you move from right to left each number is worth.
Addition and Substraction
Denary (our numbers) Binary
Absolute Value Equations November 3, 2014 Page in Notes.
PYTHON PROGRAMMING Week 12 – Tuesday. STARTER What is a flowchart? Do you know any of the symbols used in a flowchart and what they mean?
PYTHON PROGRAMMING Week 5 - Tuesday. THE FRIENDSHIP ALGORITHM Note the infinite loop!
Reasons to  Binary With Mrs
PYTHON PROGRAMMING Week 4 - Wednesday. x = 1 while True: print "Too infinity and beyond! " + str(x) x +=1.
Lecture 2: Logic Bryan Burlingame 10 Feb Ref: xkcd:
BINARY Toby Wilson. LEARNING OBJECTIVES  Be able to convert binary to denary  Be able to convert denary into binary  Be able to explain how computers.
PYTHON PROGRAMMING Week 8 - Wednesday. STARTER Fizz Buzz  Let play the game!
Lesson Aim (Data representation) To be able to: Convert B/D & D/B Convert D/H & H/D Convert H/B & B/H Perform simple binary arithmetic Represent a number.
PYTHON PROGRAMMING Week 3 - Tuesday. STARTER Hour of Code Video.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Learning Objectives 3.3.1f - Describe the nature and uses of floating point form 3.3.1h - Convert a real number to floating point form Learn how to normalise.
PYTHON PROGRAMMING Week 10 - Tuesday. GLOSSARY PROGRAM  Have a look at the program  Print it out.
Two’s Complement The language of machines, part II.
STARTER – CRACK THE CODE
Starter Using two’s Complement form convert the following from Denary to Binary using 8 bits. Answer on mini whiteboard Using two’s.
CompSci From bits to bytes to ints  At some level everything is stored as either a zero or a one  A bit is a binary digit a byte is a binary.
Lecture 2: Logic Bryan Burlingame 31 Aug 2016.
Data Representation Covering… Binary addition / subtraction
Lecturer: Santokh Singh
From bits to bytes to ints
Lecture 3: Logic Bryan Burlingame 06 Sept 2017.
Component 1 Logical operators.
Binary, Denary, Hexadecimal Conversion Binary Addition
Arithmetic Shifts and Character Representation
Negative numbers: Week 10 Lesson 1
Numeric Data Representation
Lesson Objectives Aims
Binary numbers: Week 7 Lesson 1
Boolean Algebra, Bitwise Operations
Data Representation Integers
CSE 102 Introduction to Computer Engineering
…to GCSE Level with Python Sue Sentance
Exercise: Add these two single precision IEEE 754 numbers: … …0 Left number: 1.101x24 Right number: 1.011x 22= x24.
Topic 3: Data Binary Arithmetic.
Teaching Computing to GCSE
For OCR GCSE Computing Unit 1 - Theory
Teaching Computing to GCSE
Bitwise Operators CS163 Fall 2018.
Computer Science A Level
Lesson 2: Binary to Denary Conversion.
Binary  Name: Class: .
Lesson 3: Denary to Binary Conversion.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.2 Signed Integers.
WJEC GCSE Computer Science
GCSE COMPUTER SCIENCE Topic 3 - Data 3.3 Logical and Arithmetic Shifts.
Bit Manipulations CS212.
Lecture 37 – Practice Exercises 9
Final Exam - NEXT WEEK! The final exam is worth 400 points, twice as much as each of the semester exams. The remaining homework assignments count toward.
Lecture 37 – Practice Exercises 9
Presentation transcript:

PYTHON PROGRAMMING Week 14 – Tuesday

STARTER You need to find out the average of a set of exam marks for a class. You don’t know how many marks there will be. Each mark is in the range 0 to 100. Create an algorithm to solve this problem. Show your algorithm using pseudo-code, a structure chart and a flow chart. Don’t write the program in Python!!

LAST TERM AND THIS TERM All the basics for creating Python programs Tools to help design algorithms to solve problems This term – see web site.

TODAY Recap - binary Bitwise operators in Python Python practical

RECAP - BINARY Counting in binary – class discussion

RECAP - OPERATORS Arithmetic operators: +, -, *, /, ^^, % Relational operators:, =, ==, != Boolean operators: not, and, or

BITWISE OPERATORS – CLASS RESEARCH AND EXPLANATION Research each of these to find out what they do and give an example of each: << - shift bits left >> - shift bits right & - bitwise and | - bitwise or ~ - bitwise not – the ‘complement’ ^ - bitwise exclusive or You will need to explain one of these so make some notes.

EXERCISE Write down the binary representation of the denary number 19.  What denary number would you get if you apply the shift operator to shift:  once to the left?  twice to the left?  once to the right?  twice to the right?  What if you and it with 17?  What of you or it with 17?  What is its complement (not)?  What if you xor it with 17? Check these using IDLE (when completed and shown to me!)

PYTHON PRACTICAL Complete the bitwise operator exercises Codecademy  Where are you?  What is your target for this week?

PLENARY What are the bitwise operators – add one to board What does each one do?

TOMORROW Binary, hexadecimal and denary Conversion between these bases

HOMEWORK Read and make notes on section 5.1 pages 103 to 108 – answer questions 1 to 5.