Presentation is loading. Please wait.

Presentation is loading. Please wait.

PYTHON PROGRAMING Week 15 – Tuesday.

Similar presentations


Presentation on theme: "PYTHON PROGRAMING Week 15 – Tuesday."— Presentation transcript:

1 PYTHON PROGRAMING Week 15 – Tuesday

2 have a go Convert these denary numbers to binary: 23, 45, 62, 8, 14 Now convert them to hexadecimal Convert these hexadecimal numbers to binary: 3D, 1A, FF, 0F, 56 Now convert them to denary Work out these in binary: * * 62

3 last week Bitwise operators Binary addition Binary multiplication
Hexadecimal (base 16) Denary to hex Hex to denary

4 today Targets!! Representing negative numbers in binary (Two’s complement) Binary subtraction Representing fixed point fractional numbers in binary File handling in Python

5 setting targets – comp1 & comp2
academic? maths? english?

6 twos complement Have you watched the videos?
Representation of negative numbers Most significant bit holds sign 0 – positive 1 - negative Flip the bits Add 1 Negative 1 will always be all 1s in twos complement Smallest negative number will always be a leading 1 followed by zeroes Largest positive number will always be a leading zero followed by ones

7 binary addition– twos complement
How do you think we do this?

8 binary subtraction – twos complement
How do you think we do this? What is the advantage of this when it comes to designing computer architecture? NB Overflow adding two positives giving a negative number (eg 3 bit system 3 + 2) adding two negatives giving a positive number (eg 3 bit system -4 -7)

9 fixed point fractions in binary
What is fixed point How do we represent the fractional part? …. How can we represent other fractions eg .75, .375 …

10 exercises Text book page 107 Questions 6-9 page 108 Questions 10-11
plus any of the activites

11 Python - file handling Codecademy
Where are you? What is your target for this week? Try the file handling exercises on the web site Do I need to go through file handling programs? Smaller group? NB example programs and notes are also on the site

12 PLENARY How do we represent a negative number in binary? How many values can we represent in 4 bits? How many values can we represent in 8 bits? What is the largest positive number we can hold in a four bit signed system? What is the smallest negative number in a four bit signed system? What is the process for twos complement? How do we do binary subtraction? What is a fixed point number? How do we represent a fixed point number in binary? How did we get on with file handling?

13 tomorrow Revision for mock exam Exam questions
Binary, hex, twos complement … Algorithm design tools Creating programs from designs

14 homework Have a look at revision topics and bring any questions tomorrow


Download ppt "PYTHON PROGRAMING Week 15 – Tuesday."

Similar presentations


Ads by Google