5
Programming Basics and Strings Reference book: Beginning Python

Python- Programming Basics and Strings

Embed Size (px)

DESCRIPTION

First Introduction for learning Python

Citation preview

Page 1: Python- Programming Basics and Strings

Programming Basics and Strings

Reference book: Beginning Python

Page 2: Python- Programming Basics and Strings

Installing Python

• Firstly, go to the link: www.python.org/download , and choose the OS system in your computer

• Until this time, the lastest version is Python 3.4.3 - Python 2.7.10

Page 3: Python- Programming Basics and Strings

Python with Strings

• What is strings?– String is one of the basic data types, which

programmers should meet in sometime– String is the data type consisting of any characters,

letters, symbols, numbers, or punctuation mark

Page 4: Python- Programming Basics and Strings

Python with Strings

• Display Strings in Python– Single quote: ( ‘ ) : faster approach when type

code– Double quote: ( “ ): in case to print a contraction

(ex: “don’t”)– Triple (“””): if type in shell, triple helps to display

the special characters. If type in print function, it for type code in multiple lines

Page 5: Python- Programming Basics and Strings

Python with Strings

• Combined two or more strings together– Using “+” : ex: “Hello” + “World” ‘HelloWorld’– The same result if skip the “+”

• In print() function – No need to use a space separator: ex:

print(“Hello”, “World”) Hello World• Using a format specifier to populate a string:

Ex: “Hello %s” % (“World”) ‘Hello World’