Python Programming Lecture II. Data Data is the raw material that programs manipulate. Data comes in different flavours. The basic ones are called “primitive.

Slides:



Advertisements
Similar presentations
23-Apr-15 Abstract Data Types. 2 Data types I We type data--classify it into various categories-- such as int, boolean, String, Applet A data type represents.
Advertisements

Introduction to Computing Concepts Note Set 7. Overview Variables Data Types Basic Arithmetic Expressions ▫ Arithmetic.
CSE 341, Winter Type Systems Terms to learn about types: –Type –Type system –Statically typed language –Dynamically typed language –Type error –Strongly.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
Java An introduction. Example 1 public class Example1 { public static void main (String [] args) { System.out.println (“This is the first example”); int.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Names and Bindings Introduction Names Variables The concept of binding Chapter 5-a.
Pointers| SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: September 2006 Slide 1 Pointers by Jumail Bin Taliba Faculty of Computer.
Identifiers and Assignment Statements. Data structures In any programming language you need to refer to data The simplest way is with the actual data.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
MT311 Java Application Programming and Programming Languages Li Tak Sing ( 李德成 )
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
VARIABLES AND TYPES CITS1001. Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Scope.
C# Language Panithan Chandrapatya Agenda C# History C# Goals C# Fixes C# Contribution C# Features C# Success C# Example.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
1 homework Due today: hw #1 (mailing list printout) readings to date: chapter 1 and chapter read appendix B (3 pages on DOS) and and.
Copyright ©2005  Department of Computer & Information Science Introducing Variables.
Types in programming languages1 What are types, and why do we need them?
Types(1). Lecture 52 Type(1)  A type is a collection of values and operations on those values. Integer type  values..., -2, -1, 0, 1, 2,...  operations.
Lecture 5 1.What is a variable 2.What types of information are stored in a variable 3.Getting user input from the keyboard 1.
Copyright 2010 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
COP 2510 Programming ConceptsAlessio Gaspar BSAS Industrial Operations 1 Manipulating Data Concepts Covered: Literal values, variables and Types Variables.
Programming with Microsoft Visual Basic th Edition
PHP-language Variables, assingment and arithmetic operations Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and.
1 09/03/04CS150 Introduction to Computer Science 1 What Data Do We Have.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Data Handling in Algorithms. Activity 1 Starter Task: Quickly complete the sheet 5mins!
1 CSC 1111 Introduction to Computing using C++ C++ Basics (Part 1)
Array contiguous memory locations that have the same name and type. Note: an array may contain primitive data BUT an array is a data structure a collection.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Topics for today: 1.Comments 2.Data types 3.Variable declaration.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Copyright © Texas Education Agency, Computer Programming Variables and Data Types.
Sections 10.1 – 10.4 Introduction to Arrays
Input and Output Upsorn Praphamontripong CS 1110
Building Java Programs
Documentation Need to have documentation in all programs
Lecture 2: Data Types, Variables, Operators, and Expressions
Data types and variables
Type Conversion, Constants, and the String Object
Engineering Innovation Center
Introduction to the C Language
Building Java Programs Chapter 2
Building Java Programs
Data Structures – 1D Lists
Building Java Programs
Building Java Programs Chapter 2
Building Java Programs
The Data Element.
C Programming Pointers
Building Java Programs
Building Java Programs Chapter 2
Java: Variables, Input and Arrays
The Data Element.
Understanding Variables
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Data Types and Maths Programming Guides.
An Introduction to Programming
Building Java Programs
Arrays & Loops.
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
Arrays & Loops.
Variables and Constants
Python fundamental.
Constants, Variables and Data Types
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Python Programming Lecture II

Data Data is the raw material that programs manipulate. Data comes in different flavours. The basic ones are called “primitive datatypes” –integer –real numbers –strings –boolean What are the distinguishing features of these different kinds of data?

Variables Data is stored in the memory cells of your computer. A variable is a reference to a specific cell somewhere in the computer’s memory that holds some data. In some computer languages a variable must match the type of data that it points to. –integer variable –boolean variable –string variable etc. Any attempt to assign the wrong type of data to such a variable will cause an error.

Static Typing Some programmers prefer this type of system, known as static typing because it can prevent some subtle bugs which are hard to detect. However, Python variables are not like this, they are dynamically typed. This means that the variable takes the type of value that is assigned to it.

Dynamic Typing >>> q = 7 # q is now a number >>> print q 7 >>> q = "Seven" # reassign q to a string >>> print q Seven Variables typically appear as syntactically distinguished items in programming language. In Python they must begin with an alphanumeric character and may include underscore