Simple Python Data Victor Norman CS104 Calvin College.

Slides:



Advertisements
Similar presentations
This Time Whitespace and Input/Output revisited The Programming cycle Boolean Operators The “if” control structure LAB –Write a program that takes an integer.
Advertisements

Selection Victor Norman CS104 Calvin College. Reading Quiz Counts toward your grade.
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.
What Data Do We Have? Sections 2.2, 2.5 August 29, 2008.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Fundamentals of Strings and Characters Characters.
Announcements Quiz 1 Next Week. int : Integer Range of Typically -32,768 to 32,767 (machine and compiler dependent) float : Real Number (i.e., integer.
Python November 14, Unit 7. Python Hello world, in class.
 2002 Prentice Hall. All rights reserved. 1 Intro: Java/Python Differences JavaPython Compiled: javac MyClass.java java MyClass Interpreted: python MyProgram.py.
1 CS 105 Lecture 3 Constants & Expressions Wed, Jan 26, 2011, 4:15 pm.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
Strings Victor Norman CS104 Calvin College. Reading Quiz Counts toward your grade.
Basic Input/Output and Variables Ethan Cerami New York
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Turtle Graphics Victor Norman CS104 Calvin College.
Introduction to Python
FUNCTIONS. Function call: >>> type(32) The name of the function is type. The expression in parentheses is called the argument of the function. Built-in.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
February 14, 2005 Characters, Strings and the String Class.
Input, Output, and Processing
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Lecture 3: The parts of a C++ program Professor: Dr. Miguel Alonso Jr. Fall 2008 CGS2423/COP1220.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
With Python.  One of the most useful abilities of programming is the ability to manipulate files.  Python’s operations for file management are relatively.
Variables, Expressions and Statements
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
CS 1 with Robots Variables, Data Types & Math Institute for Personal Robots in Education (IPRE)‏ Sec 9-7 Web Design.
CSC 107 – Programming For Science. Announcements.
Variables and Assignment CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Math, Data Types. Python Math Operations OperationOperator Addition + Subtraction – Multiplication * Division (floating point) / Division (integer) //
Functions Victor Norman CS104 Calvin College. Reading Quiz Counts toward your grade.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Operators and Expressions. 2 String Concatenation  The plus operator (+) is also used for arithmetic addition  The function that the + operator performs.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Ajmer Singh PGT(IP) Programming Fundamentals. Ajmer Singh PGT(IP) Java Character Set Character set is a set of valid characters that a language can recognize.
Announcements Quiz 1 Next Monday. int : Integer Range of Typically –2,147,483,648 to 2,147,483,647 (machine and compiler dependent) float : Real Number.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Think First, Code Second Understand the problem Work out step by step procedure for solving the problem (algorithm) top down design and stepwise refinement.
Strings Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
CSCI 1100/1202 January 14, Abstraction An abstraction hides (or ignores) the right details at the right time An object is abstract in that we don't.
Thinking about programming Intro to Computer Science CS1510 Dr. Sarah Diesburg.
CS 106 Introduction to Computer Science I 09 / 10 / 2007 Instructor: Michael Eckmann.
1 Structure of Simple C++ Program Chapter 1 09/09/13.
A Sample Program #include using namespace std; int main(void) { cout
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
Q and A for Sections 1 – CS 106 © 2015 Victor Norman.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Introduction to Python Lesson 2a Print and Types.
Input, Output and Variables GCSE Computer Science – Python.
Topics Designing a Program Input, Processing, and Output
Presented By S.Yamuna AP/IT
Variables, Expressions, and IO
Type Conversion, Constants, and the String Object
Register Use Policy Conventions
Thinking about programming
Input/Output Input/Output operations are performed using input/output functions Common input/output functions are provided as part of C’s standard input/output.
Introduction to Primitive Data types
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Nate Brunelle Today: Strings, Type Casting
Topics Designing a Program Input, Processing, and Output
Thinking about programming
Thinking about programming
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.
More Basics of Python Common types of data we will work with
Introduction to Primitive Data types
Data Types and Expressions
Getting Started in Python
Presentation transcript:

Simple Python Data Victor Norman CS104 Calvin College

Reading Quiz Counts toward your grade.

Data Type (or “class”) Everything has a type – Defines legal values and the operations you can do on those values. – integers: values = whole numbers; operations: add, multiply, etc. – strings: series of characters; operations: upper- case it, append to it, etc. Python must know what type of thing it is dealing with, always.

Literal Values Code must provide hints as to what type of thing you mean: – all digits  integer (int) – all digits and a dot  floating point number (float) – characters surrounded by quotes  string (str) – more to come…

Clicker questions

String Literals Can use single, double, triple-single, or triple- double quotes: – ', ", ''', """ Triple quotes useful for creating strings with quotes in them and/or newlines in them. Examples…

Type Conversion Functions Useful when you have a value that is the wrong type. – Really only needed by us when we read in a value from the user (which is always a str) and need to treat it like an int or float. Takes a value and produces a value of another type. Do NOT do this kind of thing: – float(3.14) – int(3) – str(“hello”)

Clicker Questions

Namespace and Objectspace Assignment creates/updates name in the namespace to refer to an object (new or existing) in the objectspace. Assignment steps: – evaluate the rhs (i.e., get a value for it) find object with that value or create it in objectspace. – Look up the name on lhs. if it does not exist, create it in the namespace. – Make name point to the value.

Clicker Questions

Assignment for Thursday Do TuringsCraft CodeLab questions before lab on Thursday. – These are graded and finishing before lab is crucial. Note for TC assignment: – you can print out multiple items on one line this way: x = 3 y = 4 print(x, y) print(“Result is”, x * y)