## Python: Text Concatenation

This is post 10 of 30 in the series “Introduction to Python” Go to Chapter 8 in A Smarter Way. Consider how we populate a variable with a string: first_name = “helen” last_name = ‘keller’ Now we can print them: print(first_name) print(last_name) But this isn’t quite right. The names are on separate lines. We need …

## Python: Introducing PEP 8

This is post 9 of 30 in the series “Introduction to Python” PEP 8 Python Enhancement Proposals (PEPs) dictate the rules for coding in Python. (Several other languages could use something like this.) Use this link: http://introtopython.org/lists_tuples.html#What-is-a-PEP? … but scroll up to the beginning of the section “Coding Style: PEP 8” (the link in the …

## Python: Mathematical Order of Operations

This is post 8 of 30 in the series “Introduction to Python” Go to Chapter 7 of A Smarter Way. Note the example: total_cost = 1 + 3 * 4 You’ll recall from grade school that in equations like this, multiplication (or division) is done first, then addition (or subtraction). To change this, use parentheses …

## Python: Math, Less Familiar

This is post 7 of 30 in the series “Introduction to Python” Go to Chapter 6 of A Smarter Way. A. Sometimes you need to find the remainder of a division operation. Really. It sounds crazy, but you’ll see why you’d want this later. That remainder is called the modulus. And the operator that you …

## Python: Math, Familiar

This is post 6 of 30 in the series “Introduction to Python” Go to Chapter 4 of A Smarter Way. 1. Assigning a number value to a variable: my_number = 4 2. Assigning a number by doing math: another_number = 2 + 2 3. Doing math directly with variables: my_sum = my_number + another_number Exercise …

## Python: Variable Naming

This is post 5 of 30 in the series “Introduction to Python” Go to Chapter 5 of A Smarter Way. A. Variable names can’t be enclosed in quotes. B. Variable names can’t have spaces in them. C. Variable names can’t start with numbers. D. Variable names can’t be reserved words like print, if and import. …

## Python: Variables, Strings and Numbers

This is post 4 of 30 in the series “Introduction to Python” 1. Variables: What They Look Like Go to Chapter 2 of A Smarter Way. Variable names can contain letters, numbers and underscores – nothing else. And variable names must always begin with a letter or underscore, but never a number. Variable names can …

## Python: Hello World

This is post 3 of 30 in the series “Introduction to Python” We’re going to start with Chapter 1 of A Smarter Way. 1. Open a Linux terminal. Then run the command: python 2. Simple Print Output: “Hello World” print(“Hello, World!”) Older versions of Python (most often the classic 2.7) can use slightly different syntax: …

## Python: Choosing a Text Editor or IDE

This is post 2 of 30 in the series “Introduction to Python” Which Text Editor Should You Choose? This is the kind of question that’ll get you into a war on Reddit. Do some quiet research before asking online. If you’re comfortable using vi or vim, they’re perfectly fine. Beginners don’t usually start with vi …

## Introduction to Python

This is post 1 of 30 in the series “Introduction to Python” Book: A Smarter Way to Learn Python, Mark Myers Lessons and Curricula I recommend studying Python from multiple sources: our book, online training and videos. Our Book We’ll cover lessons in A Smarter Way, and as we cover chapters we’ll look at the …