Upload
do-minh-quoc
View
11
Download
0
Embed Size (px)
DESCRIPTION
First Introduction for learning Python
Citation preview
Programming Basics and Strings
Reference book: Beginning Python
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
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
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
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’