- Introduction to Python
- Python: Choosing a Text Editor or IDE
- Python: Hello World
- Python: Variables, Strings and Numbers
- Python: Variable Naming
- Python: Math, Familiar
- Python: Math, Less Familiar
- Python: Mathematical Order of Operations
- Python: Introducing PEP 8
- Python: Text Concatenation
- Python: if Statements and Comparison Operators
- Python: else and elif statements
- Python: Testing Multiple Conditions
- Python: Testing Sets of Conditions
- Python: Nested if Statements
- Python: Lists
- Python: Adding To and Changing Lists
- Python: Lists: Take a Slice, Delete Elements, Popping Elements
- Python: Tuples
- Python: for Loops
- Python: Nested for Loops
- Python: Capturing and Formatting User Input
- Python: Dictionaries
- Python: Functions
- Python: While Loops
- Python: Data Files
- Python: Using Pexpect
- Python : Using Pexpect : ftpTestOffload.sh
- Python : Using Pexpect: ftpTest.py
- Python: DCL Conversion 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 use to get it is the modulo operator.
my_modulus = 10 % 3
B. The exponent operator is how you calculate powers of a number.
my_number = 10 ** 3
C. Shorthand operators are quick ways to perform common math.
You could, for instance, do this:
my_number = my_number + 1
But you can do it more simply:
my_number += 1
Both of these operations will add 1 to my_number. And you can do subtraction this way, too.
my_number -= 1
Go to http://www.asmarterwaytolearn.com/python/6.html and review the exercises.
- Return to your examples.py script.
- Create a variable that contains the statement “First Edition: “.
- Use a shorthand operator to add 1 to the variable my_year.
- Print these two variables on one line.