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

Slides:



Advertisements
Similar presentations
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Advertisements

Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
CS 102 Computers In Context (Multimedia)‏ 02 / 06 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 03 / 20 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 04 / 08 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 02 / 18 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 04 / 20 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 01 / 21 / 2009 Instructor: Michael Eckmann.
CIS 234: Using Data in Java Thanks to Dr. Ralph D. Westfall.
1 9/10/07CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
CS 106 Introduction to Computer Science I 01 / 30 / 2008 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 04 / 01 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 02 / 02 / 2009 Instructor: Michael Eckmann.
1 9/8/08CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
Python November 14, Unit 7. Python Hello world, in class.
CS 106 Introduction to Computer Science I 10 / 04 / 2006 Instructor: Michael Eckmann.
 2002 Prentice Hall. All rights reserved. 1 Intro: Java/Python Differences JavaPython Compiled: javac MyClass.java java MyClass Interpreted: python MyProgram.py.
CS 106 Introduction to Computer Science I 02 / 20 / 2008 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 03 / 25 / 2009 Instructor: Michael Eckmann.
Chapter 2 Data Types, Declarations, and Displays
CS 106 Introduction to Computer Science I 09 / 18 / 2006 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 09 / 11 / 2006 Instructor: Michael Eckmann.
String Escape Sequences
Chapter 1: An Introduction to Computers and Programming Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved.
CS 102 Computers In Context (Multimedia)‏ 01 / 28 / 2009 Instructor: Michael Eckmann.
C Programming Lecture 3. The Three Stages of Compiling a Program b The preprocessor is invoked The source code is modified b The compiler itself is invoked.
Variables, Assignment & Math Storing and naming data.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Chapter 2 Computer Hardware
CS 102 Computers In Context (Multimedia)‏ 01 / 23 / 2009 Instructor: Michael Eckmann.
2440: 211 Interactive Web Programming Expressions & Operators.
Python Types Python values are of various “types” Ints, Floats, Strings, Characters, and more Two representations of numbers 1 vs 1.0.
CS1 Lesson 2 Introduction to C++ CS1 Lesson 2 -- John Cole1.
Bits & Bytes Created by Chris McAbee For AAMU AGB199 Extra Credit Created from information copied and pasted from
Introduction to Computer Systems and the Java Programming Language.
CISC 110 Day 1 Hardware, Algorithms, and Programming.
CS 106 Introduction to Computer Science I 01 / 31 / 2007 Instructor: Michael Eckmann.
Bits and Bytes IGCSE. A binary number is either a 0 or a 1 and is known as a 'bit' or b inary dig it. However, the CPU cannot deal with just one bit at.
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
Variables, Expressions and Statements
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
CS 376b Introduction to Computer Vision 01 / 23 / 2008 Instructor: Michael Eckmann.
ECS 15 Variables. Outline  Using IDLE  Building blocks of programs: Text Numbers Variables!  Writing a program  Running the program.
CS 106 Introduction to Computer Science I 01 / 26 / 2007 Instructor: Michael Eckmann.
Data Representation The storage of Text Numbers Graphics.
CS 102 Computers In Context (Multimedia)‏ 03 / 30 / 2009 Instructor: Michael Eckmann.
1 CS 177 Week 2 Recitation Slides Introduction. 2 Announcements.
CS 102 Computers In Context (Multimedia)‏ 02 / 09 / 2009 Instructor: Michael Eckmann.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
CS 106 Introduction to Computer Science I 02 / 01 / 2008 Instructor: Michael Eckmann.
CS1315 Introduction to Media Computation Introduction: Why study computer science at all?!?
Know what a computer is used for Understand the difference between hardware and software Be able to describe the way that data is stored in a computer.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
PYTHON VARIABLES : CHAPTER 2 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
CS 106 Introduction to Computer Science I 09 / 10 / 2007 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 04 / 27 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 01 / 24 / 2007 Instructor: Michael Eckmann.
Python programming Using the JES picture functions and defining new functions.
Understanding Computers
Introduction to Python Lesson 2a Print and Types.
© 2004 Pearson Addison-Wesley. All rights reserved August 27, 2007 Primitive Data Types ComS 207: Programming I (in Java) Iowa State University, FALL 2007.
Understanding binary Understanding Computers.
Computer basics.
Primitive Data Types August 28, 2006 ComS 207: Programming I (in Java)
ITEC113 Algorithms and Programming Techniques
Variables, Expressions, and IO
Plan Attendance Files Posted on Campus Cruiser Homework Reminder
How Computers Store Data
Information Technology Department
Variables and Constants
Presentation transcript:

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

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

Michael Eckmann - Skidmore College - CS 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.

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

Michael Eckmann - Skidmore College - CS 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?

Michael Eckmann - Skidmore College - CS 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.

Michael Eckmann - Skidmore College - CS 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

Michael Eckmann - Skidmore College - CS 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.

Michael Eckmann - Skidmore College - CS 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 , -2.1, 0.0, 8.0 –character strings – ordered list of characters like “Mike”, “Skidmore”, “ ”, “7”, “Hello, World!”

Michael Eckmann - Skidmore College - CS 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

Michael Eckmann - Skidmore College - CS 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

Michael Eckmann - Skidmore College - CS 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).

Michael Eckmann - Skidmore College - CS 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