
Chapter 1 of Automate the Boring Stuff with Python acquaints us with the standard editor used to type commands into Python. Its called IDLE, which is short for interactive development environment. It basically lets us write one-off lines of code and execute them. We are introduced to the concept of expressions, values, operators and evaluation – essentially the types of commands and/or data issued to the computer through lines of code, and the process by which they return output to the user.
Math operators are discussed, and the order of operations is presented. We learn that when processed, python evaluates expressions down until it can return a single value to the user.
After experimenting with math examples in IDLE, we learn a little about three data types: integer, floating point and string. Integers are whole numbers. Floating point values are decimals and string is, of course, alphanumeric. I’ve seen similar designations in other languages, often as integer, real number and string.
>>> 'Bat' + 'man' 'Batman' >>> 'Hastur' * 5 'HasturHasturHasturHasturHastur'
Glancing at the table of contents, we see sections on string concatenation and replication (see above example), storing values in variables, assignment statements, variable names, comments, the print() function, the input() function, the len() function and the str(), int() and float() functions.
After the section on variable names, the file editor is introduced. It looks like, and is launched from, IDLE, but code typed into it does not immediately execute. Instead, it works like a word processor, letting us type multiple commands and save them to a file, which can then be executed and is run in IDLE.
hello world
This is the point in which we actually begin writing code. We get to write a program that asks for a person’s name, lets the user enter a name, and then responds to the user with a greeting using that name and telling the user how many letters are in the name as well as how old the user will be in a year – something a little more involved than the classic “hello world” introductory program that I grew up with.
After running the program and getting a feel for how it works, the text goes over each command, explaining how they each work and giving the user further examples of each to experiment with. I found this interesting, especially when working with numeric and text values together, since they don’t necessarily play in the same field without some kind of conversion to make them the same.
The first 3 videos in Al Sweigart’s tutorial on YouTube cover the topics in chapter 1. They can be found here:
Lesson 1 (intro):
Lesson 2 (expressions, data types, and variables):
Lesson 3 (writing your first “Hello World” program in Python):