Strings See Chapter 2 u Review constants u Strings, concatenation and repetition 1.

Slides:



Advertisements
Similar presentations
This is Java Jeopardy.
Advertisements

Chapter 3 – Fundamental Statements
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Fundamentals of Python: From First Programs Through Data Structures Chapter 2 Software Development, Data Types, and Expressions.
© 2007 Lawrenceville Press Slide 1 Chapter 3 Classes and Objects.
Variables and I/O. Types Strings –Enclosed in quotation marks –“Hello, World!” Integers –4, 3, 5, 65 Floats –4.5, 0.7 What about “56”?
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Java Intro. Strings “This is a string.” –Enclosed in double quotes “This is “ + “another “ + “string” –+ concatenates strings “This is “ “ string”
Variables and I/O. Types Strings –Enclosed in quotation marks –“Hello, World!” Integers –4, 3, 5, 65 Floats –4.5, 0.7 What about “56”?
Python Programming Chapter 2: Variables, expressions, and statements Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
JavaScript, Fourth Edition
JavaScript, Third Edition
String Escape Sequences
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
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:
Section 2 - More Basics. The char Data Type Data type of a single character Example char letter; letter = 'C';
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
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:
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Fundamentals of Python: First Programs
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 9 More About Strings.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Chapter 2 Overview of C Part I J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National Taipei University.
2440: 211 Interactive Web Programming Expressions & Operators.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Computer Programming TCP1224 Chapter 4 Variables, Constants, and Arithmetic Operators.
Chapter 2: Java Fundamentals
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Java Programming: From Problem Analysis to Program Design, 5e Chapter 2 Basic Elements of Java.
Chapter 05 (Part III) Control Statements: Part II.
©Brooks/Cole, 2001 Chapter 9 Regular Expressions.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Chapter 5 Strings CSC1310 Fall Strings Stringordered storesrepresents String is an ordered collection of characters that stores and represents text-based.
Chapter 3 Introduction To Java. OBJECTIVES Packages & Libraries Statements Comments Bytecode, compiler, interpreter Outputting print() & println() Formatting.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Chapter 3 - Visual Basic Schneider Numeric Variables Used to store numbers Value is assigned by a statement of the form: numVar = expression The variable.
Printing in Python. Printing Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Chapter 2 print / println String Literals Escape Characters Variables / data types.
An Introduction to Programming with C++ Sixth Edition Chapter 13 Strings.
Chapter 14 JavaScript: Part II The Web Warrior Guide to Web Design Technologies.
1 Chapter 2 Basic SQL SELECT Statements. 2 Chapter Objectives Distinguish between an RDBMS and an ORDBMS Identify keywords, mandatory clauses, and optional.
1 Data and Expressions Chapter 2 In PowerPoint, click on the speaker icon then the “play” button to hear audio narration.
© 2007 Lawrenceville Press Slide 1 Chapter 3 Classes and Objects 1. How is a class different from an object?
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Strings Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Chapter 2 1.What is the difference between print / println 2.What are String Literals 3.What are the Escape Characters for backslash, double quotataions,
9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 1 Restricting and Sorting Data Kroenke, Chapter Two.
Writing Basic SQL SELECT Statements Lecture
Chapter 3 Introducing Java. Objectives and Goals 1. Define terminology associated with object- oriented programming. 2. Explain why Java is a widely used.
Chapter 4 Chapter 4: Variables, Constants, and Arithmetic Operators.
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. A string is a sequence of characters Strings are objects of the String.
More about comments Review Single Line Comments The # sign is for comments. A comment is a line of text that Python won’t try to run as code. Its just.
Chapter 6 JavaScript: Introduction to Scripting
String Processing Upsorn Praphamontripong CS 1110
JavaScript Objects.
Introduction to Scripting
Section 3.2c Strings and Method Signatures
Microsoft Visual Basic 2005 BASICS
Fundamentals of Python: First Programs Second Edition
Microsoft Visual Basic 2005 BASICS
Chapter 2: Java Fundamentals
Chapter 2 Create a Chapter 2 Workspace Create a Project called Notes
Writing Basic SQL SELECT Statements
CS 1111 Introduction to Programming Spring 2019
The Data Element.
More JavaScript B. Ramamurthy 5/7/2019.
The Data Element.
Lexical Elements & Operators
Presentation transcript:

Strings See Chapter 2 u Review constants u Strings, concatenation and repetition 1

Constants u Programmers use all uppercase letters for symbolic constants –Examples: TAX_RATE and STANDARD_DEDUCTION u Constants receive values with an assignment statement = 2 TAX_RATE = 33.5 BOARD_SIZE = 64

String Literals u In Python, a string literal is a sequence of characters enclosed in single or double quotation marks  '' and "" represent the empty string  Use ''' and """ for multi-line paragraphs –The display formatting follows exactly your given format u For multi-line expressions, use a \ if formatting should be determined when displaying the string 3

String Literals, Examples 4 >>> "This very long sentence extends all the way to \ the next line." 'This very long sentence extends all the way to the next line.'

Escape Sequences u The newline character \n is called an escape sequence 5

String Concatenation  You can join two or more strings to form a new string using the concatenation operator +  The * operator allows you to build a string by repeating another string a given number of times 6

Required Readings u Fundamentals of Python Sections