Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 102 Computers In Context (Multimedia)‏ 01 / 26 / 2009 Instructor: Michael Eckmann.

Similar presentations


Presentation on theme: "CS 102 Computers In Context (Multimedia)‏ 01 / 26 / 2009 Instructor: Michael Eckmann."— Presentation transcript:

1 CS 102 Computers In Context (Multimedia)‏ 01 / 26 / 2009 Instructor: Michael Eckmann

2 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Today’s Topics Questions/comments? Chapter 1 material –Encodings

3 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Encodings At the lowest, most basic level, “Computers are electronic devices that react to voltages on wires.” (page 8, in Guzdial)‏ Some positive voltage is interpreted as (is encoded as) a 1 No voltage is interpreted as (is encoded as) a 0 One “wire” can either be encoded as a 0 or a 1 (we call this a bit)‏ So, a bit can either have the value 0 or 1, nothing else.

4 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Encodings We often group bits together in groupings of eight, which we call a byte. A byte can have a value of –00000000 –00000001 –00000010 –00000011 –00000100 –00000101 –... –all the way up to and including –11111111 Anyone have any idea how many different patterns of 0's and 1's can be stored in a byte?

5 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Encodings Computer memory (and hard disk space) is made up of bytes. Has anyone heard of the memory specifications for a PC like –contains 1 Meg of RAM –This means it has 1 Megabyte (MB) of memory –Anyone know what Mega means?

6 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Encodings Computer memory (and hard disk space) is made up of bytes. Has anyone heard of the memory specifications for a PC like –contains 1 Meg of RAM –This means it has 1 Megabyte (MB) of memory –Anyone know what Mega means? –It means approximately 1 million –So, 1 MB is approximately 1 million bytes.

7 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Encodings Why is it important to us to know about bytes? A byte is one of the basic units of space in a computer ( a bit is clearly more basic as it is a single 0 or 1, but we usually use bits in chunks of 8, which is a byte.)‏ Every file (e.g. Word Document, Image file, Sound file, plain text file, software program, etc.) is encoded in bytes. Plain text files are among the easiest (for us) to understand in terms of bytes --- every character takes up 1 byte of space. –ASCII character set

8 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Encodings As an aside: –1 MB is approximately 1 million bytes. –I say approximately, because 1 million = 1000*1000, but 1 Meg is really 1024*1024.

9 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Data Types The programs we write will work with various pieces of data. Data comes in different kinds. For example, we differentiate numeric data from text data. We need to because we can do different things with numbers than we can with text. –For instance, we can add, multiply, divide, etc. with numeric data, whereas dividing text like “CS102” / “Skidmore” doesn't make any sense. Common data types: –integer – whole numbers like -89, 0, 42, 987 –float – numbers that may contain a decimal like 3.1415, -2.1, 0.0, 8.0 –character strings – ordered list of characters like “Mike”, “Skidmore”, “3.14159”, “7”, “Hello, World!”

10 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Some Python CASE MATTERS print Arithmetic operators: * / // integer division % modulus (remainder)‏ + – ** power Strings can be denoted by single quotes ', double quotes “, or triple quotes ””” ord

11 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Some Python + concatenates strings together = assignment operator identifiers – names made up by the programmer (you) that can be used to make variables (store values), name functions, etc. –valid characters in an identifier are: letters, underscores, digits –must start with either a letter or underscore –case matters myVariable is different from myvariable

12 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Some Python def is used to define functions –A function is defined in the following way: def myFunName(parm1, parm2, parm3): statement1 statement2 statement3 statement4 Note: all statements in the body of the function must be indented like above and functions can have 0 or more parameters (the one above has 3).

13 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Some JES functions JES functions are those provided by the JES system and are not available in general in jython or python. pickAFile makePicture show makeSound play


Download ppt "CS 102 Computers In Context (Multimedia)‏ 01 / 26 / 2009 Instructor: Michael Eckmann."

Similar presentations


Ads by Google