Page 9 - Python Basics: A Practical Introduction to Python 3
P. 9
Contents
Contents 8
Foreword 13
1 Introduction 20
1.1 Why This Book? . . . . . . . . . . . . . . . . . . . . 21
1.2 About Real Python . . . . . . . . . . . . . . . . . . 23
1.3 How to Use This Book . . . . . . . . . . . . . . . . . 24
1.4 Bonus Material and Learning Resources . . . . . . . 25
2 Setting Up Python 29
2.1 A Note on Python Versions . . . . . . . . . . . . . . 30
2.2 Windows . . . . . . . . . . . . . . . . . . . . . . . 31
2.3 macOS . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.4 Ubuntu Linux . . . . . . . . . . . . . . . . . . . . . 37
3 Your First Python Program 42
3.1 Write a Python Program . . . . . . . . . . . . . . . 43
3.2 Mess Things Up . . . . . . . . . . . . . . . . . . . . 47
3.3 Create a Variable . . . . . . . . . . . . . . . . . . . 50
3.4 Inspect Values in the Interactive Window . . . . . . 55
3.5 Leave Yourself Helpful Notes . . . . . . . . . . . . . 58
3.6 Summary and Additional Resources . . . . . . . . . 60
4 Strings and String Methods 62
4.1 What Is a String? . . . . . . . . . . . . . . . . . . . 63
4.2 Concatenation, Indexing, and Slicing . . . . . . . . . 69
8