O'Reilly logo

Learn to Program with Python by Irv Kalb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Irv Kalb 2016

Irv Kalb, Learn to Program with Python, 10.1007/978-1-4842-2172-3_2

2. Variables and Assignment Statements

Irv Kalb

(1)Mountain View, California, USA

This chapter covers the following topics:

  • A sample Python program

  • Building blocks of programming

  • Four types of data

  • What a variable is

  • Rules for naming variables

  • Giving a variable a value with an assignment statement

  • A good way to name variables

  • Special Python keywords

  • Case sensitivity

  • More complicated assignment statements

  • Print statements

  • Basic math operators

  • Order of operations and parentheses

  • A few small sample programs

  • Additional naming conventions

  • How to add comments in a program

  • Use of “whitespace”

  • Errors in programs

A Sample Python Program

Let’s jump right in and see an example of what Python ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required