100% found this document useful (9 votes)
27 views

Get (Ebook) Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming by Milliken, Connor P. ISBN 9781484253540, 148425354X free all chapters

The document provides information about various Python programming ebooks available for download, including 'Python Projects for Beginners' by Connor P. Milliken. It lists multiple titles, authors, and ISBNs, along with links to access the ebooks. The document also includes a dedication and a table of contents for the featured book, outlining the chapters and topics covered.

Uploaded by

afrienorola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (9 votes)
27 views

Get (Ebook) Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming by Milliken, Connor P. ISBN 9781484253540, 148425354X free all chapters

The document provides information about various Python programming ebooks available for download, including 'Python Projects for Beginners' by Connor P. Milliken. It lists multiple titles, authors, and ISBNs, along with links to access the ebooks. The document also includes a dedication and a table of contents for the featured book, outlining the chapters and topics covered.

Uploaded by

afrienorola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Download Full Version ebook - Visit ebooknice.

com

(Ebook) Python Projects for Beginners: A Ten-Week


Bootcamp Approach to Python Programming by
Milliken, Connor P. ISBN 9781484253540, 148425354X

https://ebooknice.com/product/python-projects-for-beginners-
a-ten-week-bootcamp-approach-to-python-programming-55660652

Click the button below to download

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Python Projects for Beginners: A Ten-Week Bootcamp


Approach to Python Programming by Connor P. Milliken ISBN
9781484253557, 1484253558
https://ebooknice.com/product/python-projects-for-beginners-a-ten-
week-bootcamp-approach-to-python-programming-23452102

ebooknice.com

(Ebook) python programming: Learn To Use Python In Hacking


For Beginners In 7 Days by Osama Adel

https://ebooknice.com/product/python-programming-learn-to-use-python-
in-hacking-for-beginners-in-7-days-50790670

ebooknice.com

(Ebook) Python Programming for Beginners by Knowles, Chad

https://ebooknice.com/product/python-programming-for-
beginners-49556274

ebooknice.com

(Ebook) Python Programming for Beginners: The Most


Comprehensive Programming Guide to Become a Python Expert
from Scratch in No Time by Reed, Cory ISBN 9798354101856,
8354101851, B0BG6DC9KW
https://ebooknice.com/product/python-programming-for-beginners-the-
most-comprehensive-programming-guide-to-become-a-python-expert-from-
scratch-in-no-time-47434972
ebooknice.com
(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason;
Viles, James ISBN 9781459699816, 9781743365571,
9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

ebooknice.com

(Ebook) Python Programming for Cybersecurity. A


Comprehensive Handbook for Beginners. by ByteBazzar
Publications ISBN B0CMMX61QM
https://ebooknice.com/product/python-programming-for-cybersecurity-a-
comprehensive-handbook-for-beginners-55250950

ebooknice.com

(Ebook) Python Artificial Intelligence Projects for


Beginners by Joshua Eckroth ISBN 9781789539462, 1789539463

https://ebooknice.com/product/python-artificial-intelligence-projects-
for-beginners-57811322

ebooknice.com

(Ebook) A Beginners Guide to Python 3 Programming 2nd


Edition by John Hunt ISBN 9783031351211, 3031351215

https://ebooknice.com/product/a-beginners-guide-to-
python-3-programming-2nd-edition-51881162

ebooknice.com

(Ebook) Python Mastery: A Code Like a Pro Guide for Python


Beginners by Jonathan Bates ISBN 9781535533027, 1535533021

https://ebooknice.com/product/python-mastery-a-code-like-a-pro-guide-
for-python-beginners-6855718

ebooknice.com
Python Projects
for Beginners
A Ten-Week Bootcamp Approach to
Python Programming

Connor P. Milliken
Python Projects for
Beginners
A Ten-Week Bootcamp Approach to
Python Programming

Connor P. Milliken
Python Projects for Beginners
Connor P. Milliken
Derry, NH, USA

ISBN-13 (pbk): 978-1-4842-5354-0 ISBN-13 (electronic): 978-1-4842-5355-7


https://doi.org/10.1007/978-1-4842-5355-7

Copyright © 2020 by Connor P. Milliken


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether they are subject to proprietary
rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Nikhil Karkal
Development Editor: Rita Fernando
Coordinating Editor: Divya Modi
Cover designed by eStudioCalamar
Cover image designed by Pixabay
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street,
6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-
sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a
Delaware corporation.
For information on translations, please e-mail [email protected], or visit http://www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book's product page, located at www.apress.com/978-1-4842-5354-0. For more
detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
This book is dedicated to my girlfriend Jess.

Ever since we first met, you changed my life forever.

There’s so much that I wish to tell you each day,


like how beautiful you are, how you inspire me, or how I would
give anything just to be with you every second of the day.

Your smile lights up my whole world and you make me so


unbelievably happy.

Anytime I have a bad day, I know you’ll always be there for me.

I thought that I would only find you in my dreams, but here you are,
standing in front of me, looking beautiful as ever.

From the day I met you, I knew I wanted to give you everything.

You’re smart, motivated, beautiful, and resemble all that is


right with this world.

If I only do one thing right in life, I’d like it to be you.

I promise to always push you to be better, always support


you in times of need, and always be there with a Werther's
candy to help you study.

Your dreams have become my dreams, and whatever you want in life,

I want to be there to celebrate and help guide you.

I will always love you, past forever, with all my heart and soul.

So I have only one question left for you…

(turn the page)


Will You Marry Me?
Table of Contents
About the Author����������������������������������������������������������������������������������������������������xxi

About the Technical Reviewer������������������������������������������������������������������������������xxiii


Acknowledgments�������������������������������������������������������������������������������������������������xxv

Chapter 1: Getting Started���������������������������������������������������������������������������������������� 1


Monday: Introduction�������������������������������������������������������������������������������������������������������������������� 2
What Is Python?����������������������������������������������������������������������������������������������������������������������� 2
Why Python?���������������������������������������������������������������������������������������������������������������������������� 3
Why This Book?����������������������������������������������������������������������������������������������������������������������� 4
Who This Book Is For?������������������������������������������������������������������������������������������������������������� 4
What You’ll Learn��������������������������������������������������������������������������������������������������������������������� 5
Tuesday: Setting Up Anaconda and Python����������������������������������������������������������������������������������� 6
Cross-Platform Development�������������������������������������������������������������������������������������������������� 6
Installing Anaconda and Python for Windows������������������������������������������������������������������������� 6
What Is Anaconda?������������������������������������������������������������������������������������������������������������������ 8
What Is Jupyter Notebook?����������������������������������������������������������������������������������������������������� 8
Wednesday: How to Use the Terminal������������������������������������������������������������������������������������������� 9
Changing Directories��������������������������������������������������������������������������������������������������������������� 9
Checking the Directory���������������������������������������������������������������������������������������������������������� 10
Making Directories���������������������������������������������������������������������������������������������������������������� 10
Creating Files������������������������������������������������������������������������������������������������������������������������� 10
Checking a Version Number�������������������������������������������������������������������������������������������������� 11
Clearing the Terminal Output������������������������������������������������������������������������������������������������� 11
Using the Python Shell���������������������������������������������������������������������������������������������������������� 12
Writing Your First Line of Python������������������������������������������������������������������������������������������� 12
Exiting the Python Shell��������������������������������������������������������������������������������������������������������� 13

v
Table of Contents

Thursday: Using Jupyter Notebook��������������������������������������������������������������������������������������������� 13


Opening Jupyter Notebook���������������������������������������������������������������������������������������������������� 14
Creating a Python File����������������������������������������������������������������������������������������������������������� 14
Jupyter Notebook Cells��������������������������������������������������������������������������������������������������������� 15
Friday: Creating Your First Program�������������������������������������������������������������������������������������������� 17
Line Numbers Introduced������������������������������������������������������������������������������������������������������ 17
Creating the Program������������������������������������������������������������������������������������������������������������ 18
Final Output��������������������������������������������������������������������������������������������������������������������������� 19
Weekly Summary������������������������������������������������������������������������������������������������������������������������ 20
Weekly Challenges���������������������������������������������������������������������������������������������������������������������� 20

Chapter 2: Python Basics��������������������������������������������������������������������������������������� 21


Monday: Comments and Basic Data Types��������������������������������������������������������������������������������� 22
What Are Comments and Why Use Them?����������������������������������������������������������������������������� 22
Writing Comments����������������������������������������������������������������������������������������������������������������� 23
What Are Data Types?������������������������������������������������������������������������������������������������������������ 24
The Print Statement��������������������������������������������������������������������������������������������������������������� 24
Integers��������������������������������������������������������������������������������������������������������������������������������� 25
Floats������������������������������������������������������������������������������������������������������������������������������������� 25
Booleans�������������������������������������������������������������������������������������������������������������������������������� 25
Strings����������������������������������������������������������������������������������������������������������������������������������� 26
Tuesday: Variables����������������������������������������������������������������������������������������������������������������������� 27
How They Work���������������������������������������������������������������������������������������������������������������������� 27
Handling Naming Errors�������������������������������������������������������������������������������������������������������� 28
Integer and Float Variables���������������������������������������������������������������������������������������������������� 28
Boolean Variables������������������������������������������������������������������������������������������������������������������ 29
String Variables��������������������������������������������������������������������������������������������������������������������� 29
Using Multiple Variables�������������������������������������������������������������������������������������������������������� 29
Using Operators on Numerical Variables������������������������������������������������������������������������������� 30
Overwriting Previously Created Variables������������������������������������������������������������������������������ 30
Whitespace���������������������������������������������������������������������������������������������������������������������������� 31

vi
Table of Contents

Wednesday: Working with Strings���������������������������������������������������������������������������������������������� 31


String Concatenation������������������������������������������������������������������������������������������������������������� 32
Formatting Strings����������������������������������������������������������������������������������������������������������������� 32
String Index��������������������������������������������������������������������������������������������������������������������������� 34
String Slicing������������������������������������������������������������������������������������������������������������������������� 36
Thursday: String Manipulation���������������������������������������������������������������������������������������������������� 37
.title( )������������������������������������������������������������������������������������������������������������������������������������ 37
.replace( )������������������������������������������������������������������������������������������������������������������������������� 37
.find( )������������������������������������������������������������������������������������������������������������������������������������ 38
.strip( )����������������������������������������������������������������������������������������������������������������������������������� 38
.split( )������������������������������������������������������������������������������������������������������������������������������������ 39
Friday: Creating a Receipt Printing Program������������������������������������������������������������������������������� 39
Final Design��������������������������������������������������������������������������������������������������������������������������� 40
Initial Process������������������������������������������������������������������������������������������������������������������������ 40
Defining Our Variables����������������������������������������������������������������������������������������������������������� 41
Creating the Top Border��������������������������������������������������������������������������������������������������������� 42
Displaying the Company Info������������������������������������������������������������������������������������������������� 42
Displaying the Product Info��������������������������������������������������������������������������������������������������� 43
Displaying the Total��������������������������������������������������������������������������������������������������������������� 44
Displaying the Ending Message�������������������������������������������������������������������������������������������� 44
Displaying the Bottom Border������������������������������������������������������������������������������������������������ 45
Weekly Summary������������������������������������������������������������������������������������������������������������������������ 45
Challenge Question Solution������������������������������������������������������������������������������������������������������� 45
Weekly Challenges���������������������������������������������������������������������������������������������������������������������� 46

Chapter 3: User Input and Conditionals������������������������������������������������������������������ 47


Monday: User Input and Type Converting������������������������������������������������������������������������������������ 48
Accepting User Input������������������������������������������������������������������������������������������������������������� 48
Storing User Input������������������������������������������������������������������������������������������������������������������ 48
What Is Type Converting?������������������������������������������������������������������������������������������������������ 49
Checking the Type����������������������������������������������������������������������������������������������������������������� 49

vii
Table of Contents

Converting Data Types����������������������������������������������������������������������������������������������������������� 49


Converting User Input������������������������������������������������������������������������������������������������������������ 50
Handling Errors���������������������������������������������������������������������������������������������������������������������� 51
Code Blocks and Indentation������������������������������������������������������������������������������������������������� 52
Tuesday: If Statements���������������������������������������������������������������������������������������������������������������� 52
How They Work���������������������������������������������������������������������������������������������������������������������� 53
Writing Your First If Statement���������������������������������������������������������������������������������������������� 53
Comparison Operators����������������������������������������������������������������������������������������������������������� 54
Checking User Input�������������������������������������������������������������������������������������������������������������� 54
Logical Operators������������������������������������������������������������������������������������������������������������������ 55
Membership Operators���������������������������������������������������������������������������������������������������������� 56
Wednesday: Elif Statements������������������������������������������������������������������������������������������������������� 58
How They Work���������������������������������������������������������������������������������������������������������������������� 58
Writing Your First Elif Statement������������������������������������������������������������������������������������������� 59
Checking Multiple Elif Conditions������������������������������������������������������������������������������������������ 59
Conditionals Within Conditionals������������������������������������������������������������������������������������������� 60
If Statements vs. Elif Statements������������������������������������������������������������������������������������������ 60
Thursday: Else Statements��������������������������������������������������������������������������������������������������������� 62
How They Work���������������������������������������������������������������������������������������������������������������������� 62
Writing Your First Else Statement������������������������������������������������������������������������������������������ 62
Complete Conditional Statement������������������������������������������������������������������������������������������� 63
Friday: Creating a Calculator������������������������������������������������������������������������������������������������������� 64
Final Design��������������������������������������������������������������������������������������������������������������������������� 65
Step #1: Ask User for Calculation to Be Performed��������������������������������������������������������������� 65
Step #2: Ask for Numbers, Alert Order Matters��������������������������������������������������������������������� 66
Step #3: Set Up Try/Except for Mathematical Operation�������������������������������������������������������� 66
Final Output��������������������������������������������������������������������������������������������������������������������������� 67
Weekly Summary������������������������������������������������������������������������������������������������������������������������ 69
Challenge Question Solution������������������������������������������������������������������������������������������������������� 69
Weekly Challenges���������������������������������������������������������������������������������������������������������������������� 69

viii
Table of Contents

Chapter 4: Lists and Loops������������������������������������������������������������������������������������� 71


Monday: Lists������������������������������������������������������������������������������������������������������������������������������ 72
What Are Lists?���������������������������������������������������������������������������������������������������������������������� 72
Declaring a List of Numbers�������������������������������������������������������������������������������������������������� 72
Accessing Elements Within a List������������������������������������������������������������������������������������������ 73
Declaring a List of Mixed Data Types������������������������������������������������������������������������������������� 73
Lists Within Lists������������������������������������������������������������������������������������������������������������������� 74
Accessing Lists Within Lists�������������������������������������������������������������������������������������������������� 74
Changing Values in a List������������������������������������������������������������������������������������������������������ 75
Variable Storage�������������������������������������������������������������������������������������������������������������������� 76
Copying a List������������������������������������������������������������������������������������������������������������������������ 77
Tuesday: For Loops��������������������������������������������������������������������������������������������������������������������� 78
How Loops Work�������������������������������������������������������������������������������������������������������������������� 78
Writing a For Loop����������������������������������������������������������������������������������������������������������������� 78
Range()���������������������������������������������������������������������������������������������������������������������������������� 80
Looping by Element��������������������������������������������������������������������������������������������������������������� 80
Continue Statement��������������������������������������������������������������������������������������������������������������� 81
Break Statement�������������������������������������������������������������������������������������������������������������������� 82
Pass Statement��������������������������������������������������������������������������������������������������������������������� 82
Wednesday: While Loops������������������������������������������������������������������������������������������������������������ 83
Writing a While Loop�������������������������������������������������������������������������������������������������������������� 84
While vs. For�������������������������������������������������������������������������������������������������������������������������� 84
Infinite Loops������������������������������������������������������������������������������������������������������������������������� 84
Nested Loops������������������������������������������������������������������������������������������������������������������������� 85
Thursday: Working with Lists������������������������������������������������������������������������������������������������������ 86
Checking Length�������������������������������������������������������������������������������������������������������������������� 87
Slicing Lists��������������������������������������������������������������������������������������������������������������������������� 87
Adding Items������������������������������������������������������������������������������������������������������������������������� 88
Removing Items��������������������������������������������������������������������������������������������������������������������� 88
Working with Numerical List Data����������������������������������������������������������������������������������������� 90
Sorting a List������������������������������������������������������������������������������������������������������������������������� 90

ix
Table of Contents

Conditionals and Lists����������������������������������������������������������������������������������������������������������� 91


Loops and Lists��������������������������������������������������������������������������������������������������������������������� 92
Friday: Creating Hangman����������������������������������������������������������������������������������������������������������� 93
Final Design��������������������������������������������������������������������������������������������������������������������������� 94
Previous Line Symbols Introduced���������������������������������������������������������������������������������������� 94
Adding Imports���������������������������������������������������������������������������������������������������������������������� 95
Declaring Game Variables������������������������������������������������������������������������������������������������������ 96
Generating the Hidden Word�������������������������������������������������������������������������������������������������� 96
Creating the Game Loop�������������������������������������������������������������������������������������������������������� 97
Outputting Game Information������������������������������������������������������������������������������������������������ 97
Checking a Guess������������������������������������������������������������������������������������������������������������������ 98
Clearing Output���������������������������������������������������������������������������������������������������������������������� 98
Creating the Losing Condition����������������������������������������������������������������������������������������������� 99
Handling Correct Guesses����������������������������������������������������������������������������������������������������� 99
Creating a Winning Condition���������������������������������������������������������������������������������������������� 100
Outputting Guessed Letters������������������������������������������������������������������������������������������������� 101
Adding Guessed Letters������������������������������������������������������������������������������������������������������� 101
Handling Previous Guesses������������������������������������������������������������������������������������������������� 102
Final Output������������������������������������������������������������������������������������������������������������������������� 102
Weekly Summary���������������������������������������������������������������������������������������������������������������������� 103
Challenge Question Solution����������������������������������������������������������������������������������������������������� 103
Weekly Challenges�������������������������������������������������������������������������������������������������������������������� 104

Chapter 5: Functions�������������������������������������������������������������������������������������������� 105


Monday: Creating and Calling Functions����������������������������������������������������������������������������������� 106
What Are Functions?����������������������������������������������������������������������������������������������������������� 106
Function Syntax������������������������������������������������������������������������������������������������������������������� 107
Writing Your First Function�������������������������������������������������������������������������������������������������� 107
Function Stages������������������������������������������������������������������������������������������������������������������� 108
UDF vs. Built-in�������������������������������������������������������������������������������������������������������������������� 109
Performing a Calculation����������������������������������������������������������������������������������������������������� 109

x
Table of Contents

Tuesday: Parameters����������������������������������������������������������������������������������������������������������������� 110


What Are Parameters?��������������������������������������������������������������������������������������������������������� 110
Passing a Single Parameter������������������������������������������������������������������������������������������������ 111
Multiple Parameters������������������������������������������������������������������������������������������������������������ 111
Passing a List���������������������������������������������������������������������������������������������������������������������� 112
Default Parameters�������������������������������������������������������������������������������������������������������������� 113
Making Parameters Optional����������������������������������������������������������������������������������������������� 113
Named Parameter Assignment�������������������������������������������������������������������������������������������� 114
*args������������������������������������������������������������������������������������������������������������������������������������ 114
**kwargs������������������������������������������������������������������������������������������������������������������������������ 115
Wednesday: Return Statement������������������������������������������������������������������������������������������������� 116
How It Works����������������������������������������������������������������������������������������������������������������������� 116
Using Return������������������������������������������������������������������������������������������������������������������������ 117
Ternary Operator������������������������������������������������������������������������������������������������������������������ 118
Thursday: Scope����������������������������������������������������������������������������������������������������������������������� 119
Types of Scope�������������������������������������������������������������������������������������������������������������������� 119
Global Scope Access����������������������������������������������������������������������������������������������������������� 119
Handling Function Scope����������������������������������������������������������������������������������������������������� 120
In-Place Algorithms������������������������������������������������������������������������������������������������������������� 120
Friday: Creating a Shopping Cart���������������������������������������������������������������������������������������������� 121
Final Design������������������������������������������������������������������������������������������������������������������������� 122
Initial Setup������������������������������������������������������������������������������������������������������������������������� 122
Adding Items����������������������������������������������������������������������������������������������������������������������� 123
Removing Items������������������������������������������������������������������������������������������������������������������� 123
Showing the Cart����������������������������������������������������������������������������������������������������������������� 124
Clearing the Cart������������������������������������������������������������������������������������������������������������������ 124
Creating the Main Loop������������������������������������������������������������������������������������������������������� 124
Handling User Input������������������������������������������������������������������������������������������������������������� 125
Final Output������������������������������������������������������������������������������������������������������������������������� 126

xi
Table of Contents

Weekly Summary���������������������������������������������������������������������������������������������������������������������� 126


Challenge Question Solution����������������������������������������������������������������������������������������������������� 127
Weekly Challenges�������������������������������������������������������������������������������������������������������������������� 127

Chapter 6: Data Collections and Files������������������������������������������������������������������� 129


Monday: Dictionaries���������������������������������������������������������������������������������������������������������������� 129
What Are Dictionaries?�������������������������������������������������������������������������������������������������������� 130
Declaring a Dictionary��������������������������������������������������������������������������������������������������������� 130
Accessing Dictionary Information���������������������������������������������������������������������������������������� 131
Using the Get Method���������������������������������������������������������������������������������������������������������� 131
Dictionaries with Lists��������������������������������������������������������������������������������������������������������� 132
Lists with Dictionaries��������������������������������������������������������������������������������������������������������� 132
Dictionaries with Dictionaries���������������������������������������������������������������������������������������������� 133
Tuesday: Working with Dictionaries������������������������������������������������������������������������������������������ 134
Adding New Information������������������������������������������������������������������������������������������������������ 134
Changing Information���������������������������������������������������������������������������������������������������������� 135
Deleting Information������������������������������������������������������������������������������������������������������������ 135
Looping a Dictionary������������������������������������������������������������������������������������������������������������ 135
Wednesday: Tuples, Sets, Frozensets��������������������������������������������������������������������������������������� 137
What Are Tuples?����������������������������������������������������������������������������������������������������������������� 137
Declaring a Tuple����������������������������������������������������������������������������������������������������������������� 138
What Are Sets?�������������������������������������������������������������������������������������������������������������������� 138
Declaring a Set�������������������������������������������������������������������������������������������������������������������� 138
What Are Frozensets?���������������������������������������������������������������������������������������������������������� 139
Declaring a Frozenset���������������������������������������������������������������������������������������������������������� 139
Data Collection Differences������������������������������������������������������������������������������������������������� 140
Thursday: Reading and Writing Files����������������������������������������������������������������������������������������� 140
Working with Text Files�������������������������������������������������������������������������������������������������������� 141
Writing to CSV Files������������������������������������������������������������������������������������������������������������� 142
Reading from CSV Files������������������������������������������������������������������������������������������������������� 142
File Modes in Python����������������������������������������������������������������������������������������������������������� 143

xii
Table of Contents

Friday: Creating a User Database with CSV Files���������������������������������������������������������������������� 144


Final Design������������������������������������������������������������������������������������������������������������������������� 144
Setting Up Necessary Imports��������������������������������������������������������������������������������������������� 145
Handling User Registration�������������������������������������������������������������������������������������������������� 145
Handling User Login������������������������������������������������������������������������������������������������������������ 146
Creating the Main Loop������������������������������������������������������������������������������������������������������� 147
Weekly Summary���������������������������������������������������������������������������������������������������������������������� 148
Challenge Question Solution����������������������������������������������������������������������������������������������������� 149
Weekly Challenges�������������������������������������������������������������������������������������������������������������������� 149

Chapter 7: Object-Oriented Programming������������������������������������������������������������ 151


Monday: Creating and Instantiating a Class������������������������������������������������������������������������������ 152
What Is an Object?�������������������������������������������������������������������������������������������������������������� 152
OOP Stages�������������������������������������������������������������������������������������������������������������������������� 153
Creating a Class������������������������������������������������������������������������������������������������������������������� 153
Creating an Instance����������������������������������������������������������������������������������������������������������� 154
Creating Multiple Instances������������������������������������������������������������������������������������������������� 154
Tuesday: Attributes�������������������������������������������������������������������������������������������������������������������� 156
Declaring and Accessing Attributes������������������������������������������������������������������������������������� 156
Changing an Instance Attributes����������������������������������������������������������������������������������������� 157
Using the __init__( ) Method����������������������������������������������������������������������������������������������� 157
The “self” Keyword�������������������������������������������������������������������������������������������������������������� 158
Instantiating Multiple Objects with __init__( )��������������������������������������������������������������������� 159
Global Attributes vs. Instance Attributes����������������������������������������������������������������������������� 159
Wednesday: Methods���������������������������������������������������������������������������������������������������������������� 161
Defining and Calling a Method�������������������������������������������������������������������������������������������� 161
Accessing Class Attributes in Methods������������������������������������������������������������������������������� 162
Method Scope��������������������������������������������������������������������������������������������������������������������� 162
Passing Arguments into Methods���������������������������������������������������������������������������������������� 163
Using Setters and Getters���������������������������������������������������������������������������������������������������� 164
Incrementing Attributes with Methods�������������������������������������������������������������������������������� 165

xiii
Table of Contents

Methods Calling Methods���������������������������������������������������������������������������������������������������� 166


Magic Methods�������������������������������������������������������������������������������������������������������������������� 166
Thursday: Inheritance��������������������������������������������������������������������������������������������������������������� 168
What Is Inheritance?������������������������������������������������������������������������������������������������������������ 168
Inheriting a Class����������������������������������������������������������������������������������������������������������������� 168
Using the super( ) Method��������������������������������������������������������������������������������������������������� 169
Method Overriding��������������������������������������������������������������������������������������������������������������� 170
Inheriting Multiple Classes�������������������������������������������������������������������������������������������������� 171
Friday: Creating Blackjack�������������������������������������������������������������������������������������������������������� 172
Final Design������������������������������������������������������������������������������������������������������������������������� 173
Setting Up Imports��������������������������������������������������������������������������������������������������������������� 174
Creating the Game Class����������������������������������������������������������������������������������������������������� 174
Generating the Deck������������������������������������������������������������������������������������������������������������ 175
Pulling a Card from the Deck����������������������������������������������������������������������������������������������� 175
Creating a Player Class�������������������������������������������������������������������������������������������������������� 176
Adding Cards to the Player’s Hand�������������������������������������������������������������������������������������� 177
Showing a Player’s Hand����������������������������������������������������������������������������������������������������� 178
Calculating the Hand Total��������������������������������������������������������������������������������������������������� 179
Handling the Player’s Turn��������������������������������������������������������������������������������������������������� 181
Handling the Dealer’s Turn�������������������������������������������������������������������������������������������������� 182
Calculating a Winner������������������������������������������������������������������������������������������������������������ 183
Final Output������������������������������������������������������������������������������������������������������������������������� 184
Weekly Summary���������������������������������������������������������������������������������������������������������������������� 184
Challenge Question Solution����������������������������������������������������������������������������������������������������� 185
Weekly Challenges�������������������������������������������������������������������������������������������������������������������� 185

Chapter 8: Advanced Topics I: Efficiency�������������������������������������������������������������� 187


Monday: List Comprehension���������������������������������������������������������������������������������������������������� 188
List Comprehension Syntax������������������������������������������������������������������������������������������������� 188
Generating a List of Numbers���������������������������������������������������������������������������������������������� 189
If Statements����������������������������������������������������������������������������������������������������������������������� 190
If-Else Statements��������������������������������������������������������������������������������������������������������������� 190

xiv
Table of Contents

List Comprehension with Variables������������������������������������������������������������������������������������� 191


Dictionary Comprehension�������������������������������������������������������������������������������������������������� 192
Tuesday: Lambda Functions������������������������������������������������������������������������������������������������������ 193
Lambda Function Syntax����������������������������������������������������������������������������������������������������� 193
Using a Lambda������������������������������������������������������������������������������������������������������������������� 193
Passing Multiple Arguments������������������������������������������������������������������������������������������������ 194
Saving Lambda Functions��������������������������������������������������������������������������������������������������� 195
Conditional Statements������������������������������������������������������������������������������������������������������� 195
Returning a Lambda������������������������������������������������������������������������������������������������������������ 196
Wednesday: Map, Filter, and Reduce���������������������������������������������������������������������������������������� 197
Map Without Lambdas��������������������������������������������������������������������������������������������������������� 197
Map with Lambdas�������������������������������������������������������������������������������������������������������������� 198
Filter Without Lambdas�������������������������������������������������������������������������������������������������������� 199
Filter with Lambdas������������������������������������������������������������������������������������������������������������� 200
The Problem with Reduce��������������������������������������������������������������������������������������������������� 201
Using Reduce����������������������������������������������������������������������������������������������������������������������� 201
Thursday: Recursive Functions and Memoization��������������������������������������������������������������������� 203
Understanding Recursive Functions������������������������������������������������������������������������������������ 203
Writing a Factorial Function������������������������������������������������������������������������������������������������ 204
The Fibonacci Sequence����������������������������������������������������������������������������������������������������� 205
Understanding Memoization������������������������������������������������������������������������������������������������ 206
Using Memoization�������������������������������������������������������������������������������������������������������������� 207
Using @lru_cache��������������������������������������������������������������������������������������������������������������� 208
Friday: Writing a Binary Search������������������������������������������������������������������������������������������������� 209
Final Design������������������������������������������������������������������������������������������������������������������������� 209
Program Setup�������������������������������������������������������������������������������������������������������������������� 211
Step 1: Sort the List������������������������������������������������������������������������������������������������������������� 211
Step 2: Find the Middle Index���������������������������������������������������������������������������������������������� 212
Step 3: Check the Value at the Middle Index����������������������������������������������������������������������� 213
Step 4: Check if Value Is Greater����������������������������������������������������������������������������������������� 213
Step 5: Check if Value Is Less���������������������������������������������������������������������������������������������� 214

xv
Table of Contents

Step 6: Set Up a Loop to Repeat Steps�������������������������������������������������������������������������������� 214


Step 7: Return False Otherwise������������������������������������������������������������������������������������������� 215
Final Output������������������������������������������������������������������������������������������������������������������������� 216
Weekly Summary���������������������������������������������������������������������������������������������������������������������� 217
Challenge Question Solution����������������������������������������������������������������������������������������������������� 217
Weekly Challenges�������������������������������������������������������������������������������������������������������������������� 218

Chapter 9: Advanced Topics II: Complexity���������������������������������������������������������� 219


Monday: Generators and Iterators��������������������������������������������������������������������������������������������� 220
Iterators vs. Iterables����������������������������������������������������������������������������������������������������������� 220
Creating a Basic Iterator������������������������������������������������������������������������������������������������������ 220
Creating Our Own Iterator���������������������������������������������������������������������������������������������������� 221
What Are Generators?���������������������������������������������������������������������������������������������������������� 222
Creating a Range Generator������������������������������������������������������������������������������������������������ 222
Tuesday: Decorators������������������������������������������������������������������������������������������������������������������ 224
What Are Decorators?���������������������������������������������������������������������������������������������������������� 224
Higher-Order Functions������������������������������������������������������������������������������������������������������� 225
Creating and Applying a Decorator�������������������������������������������������������������������������������������� 225
Decorators with Parameters������������������������������������������������������������������������������������������������ 226
Functions with Decorators and Parameters������������������������������������������������������������������������ 226
Restricting Function Access������������������������������������������������������������������������������������������������ 227
Wednesday: Modules���������������������������������������������������������������������������������������������������������������� 229
Importing a Module������������������������������������������������������������������������������������������������������������� 229
Importing Only Variables and Functions������������������������������������������������������������������������������ 230
Using an Alias���������������������������������������������������������������������������������������������������������������������� 231
Creating Our Own Module��������������������������������������������������������������������������������������������������� 231
Using Our Module in Jupyter Notebook������������������������������������������������������������������������������� 232
Thursday: Understanding Algorithmic Complexity�������������������������������������������������������������������� 234
What Is Big O Notation?������������������������������������������������������������������������������������������������������� 234
Hash Tables������������������������������������������������������������������������������������������������������������������������� 236
Dictionaries vs. Lists����������������������������������������������������������������������������������������������������������� 238
Battle of the Algorithms������������������������������������������������������������������������������������������������������� 239

xvi
Table of Contents

Friday: Interview Prep��������������������������������������������������������������������������������������������������������������� 241


Developer Interview Process����������������������������������������������������������������������������������������������� 241
What to Do Before the Interview����������������������������������������������������������������������������������������� 243
General Questions��������������������������������������������������������������������������������������������������������������� 245
Whiteboarding and Technical Questions������������������������������������������������������������������������������ 248
End of Interview Questions�������������������������������������������������������������������������������������������������� 249
What to Do After the Interview�������������������������������������������������������������������������������������������� 250
Weekly Summary���������������������������������������������������������������������������������������������������������������������� 251
Challenge Question Solution����������������������������������������������������������������������������������������������������� 252
Weekly Challenges�������������������������������������������������������������������������������������������������������������������� 252

Chapter 10: Introduction to Data Analysis������������������������������������������������������������ 253


Monday: Virtual Environments and Requests Module��������������������������������������������������������������� 254
What Are Virtual Environments?������������������������������������������������������������������������������������������ 254
What Is Pip?������������������������������������������������������������������������������������������������������������������������� 256
Creating a Virtual Environment�������������������������������������������������������������������������������������������� 256
Activating the Virtual Environment�������������������������������������������������������������������������������������� 257
Installing Packages������������������������������������������������������������������������������������������������������������� 258
APIs and the Requests Module�������������������������������������������������������������������������������������������� 259
Using the Requests Module������������������������������������������������������������������������������������������������� 259
Tuesday: Pandas����������������������������������������������������������������������������������������������������������������������� 263
What Is Pandas?������������������������������������������������������������������������������������������������������������������ 263
Key Terms���������������������������������������������������������������������������������������������������������������������������� 264
Installing Pandas����������������������������������������������������������������������������������������������������������������� 265
Importing Pandas���������������������������������������������������������������������������������������������������������������� 265
Creating a DataFrame���������������������������������������������������������������������������������������������������������� 265
Accessing Data�������������������������������������������������������������������������������������������������������������������� 267
Built-in Methods������������������������������������������������������������������������������������������������������������������ 268
Filtration������������������������������������������������������������������������������������������������������������������������������ 271
Column Transformations������������������������������������������������������������������������������������������������������ 272
Aggregations����������������������������������������������������������������������������������������������������������������������� 274

xvii
Table of Contents

Pandas Joins����������������������������������������������������������������������������������������������������������������������� 277


Dataset Pipeline������������������������������������������������������������������������������������������������������������������ 280
Wednesday: Data Visualization������������������������������������������������������������������������������������������������� 281
Types of Charts�������������������������������������������������������������������������������������������������������������������� 282
Installing Matplotlib������������������������������������������������������������������������������������������������������������� 282
Importing Matplotlib������������������������������������������������������������������������������������������������������������ 283
Line Plot������������������������������������������������������������������������������������������������������������������������������� 283
Bar Plot�������������������������������������������������������������������������������������������������������������������������������� 285
Box Plot������������������������������������������������������������������������������������������������������������������������������� 286
Scatter Plot�������������������������������������������������������������������������������������������������������������������������� 288
Histogram���������������������������������������������������������������������������������������������������������������������������� 289
Saving the Chart������������������������������������������������������������������������������������������������������������������ 292
Flattening Multidimensional Data���������������������������������������������������������������������������������������� 293
Thursday: Web Scraping����������������������������������������������������������������������������������������������������������� 295
Installing Beautiful Soup����������������������������������������������������������������������������������������������������� 295
Importing Beautiful Soup����������������������������������������������������������������������������������������������������� 295
Requesting Page Content���������������������������������������������������������������������������������������������������� 296
Parsing the Response with Beautiful Soup������������������������������������������������������������������������� 297
Scraping Data���������������������������������������������������������������������������������������������������������������������� 297
DOM Traversal��������������������������������������������������������������������������������������������������������������������� 299
Friday: Web Site Analysis���������������������������������������������������������������������������������������������������������� 304
Final Design������������������������������������������������������������������������������������������������������������������������� 304
Importing Libraries�������������������������������������������������������������������������������������������������������������� 306
Creating the Main Loop������������������������������������������������������������������������������������������������������� 307
Scraping the Web Site��������������������������������������������������������������������������������������������������������� 307
Scrape All Text��������������������������������������������������������������������������������������������������������������������� 308
Filtering Elements��������������������������������������������������������������������������������������������������������������� 309
Filtering Waste��������������������������������������������������������������������������������������������������������������������� 310
Count Word Frequency�������������������������������������������������������������������������������������������������������� 312
Sort Dictionary by Word Frequency������������������������������������������������������������������������������������� 313
Displaying the Top Word������������������������������������������������������������������������������������������������������ 313

xviii
Table of Contents

Graphing the Results����������������������������������������������������������������������������������������������������������� 314


Final Output������������������������������������������������������������������������������������������������������������������������� 315
Weekly Summary���������������������������������������������������������������������������������������������������������������������� 315
Challenge Question Solution����������������������������������������������������������������������������������������������������� 316
Weekly Challenges�������������������������������������������������������������������������������������������������������������������� 316

Afterword: Post-Course: What to Do Now?����������������������������������������������������������� 319


Back-End Development with Python����������������������������������������������������������������������������������������� 319
Full-Stack Development with Python���������������������������������������������������������������������������������������� 320
Data Analysis with Python��������������������������������������������������������������������������������������������������������� 320
Data Science with Python��������������������������������������������������������������������������������������������������������� 320
Resources��������������������������������������������������������������������������������������������������������������������������������� 320
Final Message��������������������������������������������������������������������������������������������������������������������������� 323

Index��������������������������������������������������������������������������������������������������������������������� 325

xix
About the Author
Connor P. Milliken Focused on helping others achieve their
goals through education and technology, Connor P. Milliken
brings a wealth of programming and business experience to
his classes.
He graduated with a computer science degree from
Daniel Webster College and is pursuing a master’s in
computer science with a focus in interactive intelligence
from Georgia Tech.
Before becoming an instructor at Coding Temple, he was
designing simulators in the video game industry for several
years. During that time, he took on a vast number of roles
from business to programming that he used to release a total of 11 different titles on PC
and co-created an award-winning football card game called “Masters of the Gridiron.”
Connor has experience in more than seven different languages and three frameworks.
He focuses primarily in web development and data analytics using Python. When this
book was written, he taught for a coding bootcamp in Boston, MA, where students
can learn Python, web development, and data analytics over a 10-­week full-time course.
He is now a software engineer at Hubspot, Inc. in Cambridge, MA.
Github: Connor-SM

xxi
About the Technical Reviewer
Bharath Thiruveedula currently works for a major telco
service provider. He is core reviewer and key contributor to
various OpenStack/ONAP projects. Bharath is passionate
about open source technologies and is an evangelist who
is focused on making his mark in the Cloud/Container
domains. He has been working on distributed systems and
machine learning for a significant amount of time.

xxiii
Acknowledgments
I would like to thank the following people for their generosity and help:

Jessica Boucher, who has been my rock this whole time. Your love
and support have continued to help me in all my endeavors. I’m
truly blessed to have you in my life.

My family, who have supported and believed in me all my life.


Without your guidance, none of this would be possible. To have
parents and siblings like you all is nothing short of a miracle and I
wouldn’t have it any other way.

Clay and Dee Dreslough, who gave me an opportunity and


mentored me. This book would not be possible without your
guidance over the years. It was at Sports Mogul that I had realized
my passion of computer programming, thanks to you both.

Derek Hawkins, who mentored and taught me a lot about


teaching, programming, Python, and Ping Pong.

Kirsten Arnold, who created all the art within this book. The work
you were able to create from my poor drawing skills was exactly
what I had imagined.

Ripal Patel, who helped with the interview portion of Week


9. Your expertise in the hiring and interview process has been
wonderful for not only me but the students.
My friends, who over the years have been there for me through it
all. Whether it was watching my dog, going on adventures, or just
hanging out… thank you. I will always make the drive for you all.

My coaches, who taught me about perseverance, hard work,


commitment, and teamwork. Whether it was 6 AM practices or
triple sessions in the middle of summer, you’ve played a big part
in my life and for that I’m grateful.

xxv
Acknowledgments

The Coding Temple team, who gave me the opportunity and


entrusted me to educate those wanting to pursue a career in tech.

The Apress team, who have helped me throughout this entire


process with writing, formatting, reviewing, and more.

My students, who helped to show me why teaching is so


rewarding.

xxvi
CHAPTER 1

Getting Started
Hello there! Welcome to your first step toward becoming a Python developer. Exciting
isn’t it? Whether you’re just beginning to learn how to program, or have experience in
other languages, the lessons taught in this book will help to accelerate your goals. As a
Python instructor, I can guarantee you that it’s not about where you start, it’s about how
hard you’re willing to work.
At the time of writing this book, my daily job is a coding bootcamp instructor where I
teach students how to go from zero programming experience to professional developers
in just ten weeks. This book was designed with the intent to bring a bootcamp-based
approach to text. This book aims to help you learn subjects that are valuable to becoming
a professional developer with Python.
Each subsequent chapter will have an overview and a brief description of what we’ll
cover that week. This week we’ll be covering all the necessary basics to get us jump
started. Following the age old saying, “You must learn to walk before you can run,” we
must understand what our tools are and how to use them before we can begin coding.
Overview

• Understanding why and how this book works


• Installing Python and Anaconda

• Understanding how to use these new tools

• Understanding how to use the terminal

• Writing your first Python program

Without further ado, let’s get started, shall we?

1
© Connor P. Milliken 2020
C. P. Milliken, Python Projects for Beginners, https://doi.org/10.1007/978-1-4842-5355-7_1
Chapter 1 Getting Started

Monday: Introduction
Almost every programmer remembers that “Aha!” moment, when everything clicked
for them. For me that was when I picked up Python. After years of computer science
education, one of the best methods I found to learn was by building applications and
applying the knowledge you learn. That’s why this book will have you coding along
rather than reading about the theory behind programming. Python makes it simple to
pick up concepts otherwise difficult in other languages. This makes it a great language
for breaking into the development industry!
You may have already noticed that the structure of this book is different than most.
Instead of chapters, we have each topic separated by weeks or days. Notice the current
header for the section. This is part of the bootcamp-based approach, so that you may set
goals for each day. There will be two ways to follow along this book:

1. Over the course of ten weeks

2. Over the course of ten days

If you’d like to follow the 10-week approach, then think of each chapter as a weekly
goal. All chapters are broken up further into daily segments Monday to Friday. The
first four days, Monday through Thursday, will introduce new concepts to understand.
Friday, or better known as Project Day, is where we will create a program together
based on the lessons learned throughout the week. The focus is that you set aside 30–60
minutes each day to complete each daily task.
If you’re eager enough to try the bootcamp style, where you learn all the material
in ten days, then think of each chapter as a single day. Granted, you must know that in
order to complete this book in ten days, you will need to dedicate around 8 hours per
day, which is a typical day for coding bootcamp students. In bootcamps (like the one I
taught), we go over several concepts daily, and each subsequent day we reiterate the
topics learned from previous lessons. This helps to accelerate the process of learning
each concept.

What Is Python?
Python is an interpreted, high-level, general-purpose programming language. To
understand what each of these descriptions mean, let’s make a few comparisons:

2
Chapter 1 Getting Started

• Low Level vs. High Level: Refers to whether we program using


instructions and data objects at the level of the machine or whether
we program using more abstract operations that have been provided
by the language designer. Low-level languages (like C, C++) require
you to allocate and manage memory, whereas Python manages
memory for us.

• General Purpose vs. Targeted: Refers to whether the operations of


the programming language are widely applicable or are fine-tuned to
a domain. For example, SQL is a targeted language that is designed
to facilitate extracting information from relational databases, but you
wouldn’t want to use it to build an operating system.

• Interpreted vs. Compiled: Refers to whether the sequence of


instructions written by the programmer, called “source code,” is
executed directly (by an interpreter) or whether it is first converted
(by a compiler) into a sequence of machine-level primitive
operations. Most applications designed with Python are run through
the interpreter, so errors are found at runtime.

Python also emphasizes code readability and uses whitespace to separate snippets of
code. We’ll learn more about how whitespace in Python works as we get into our lessons,
but for now just know that Python is a great first language to break into the computer
science industry.

Why Python?
I could go on about why Python is so amazing, but a simple Google search would do
that for me. Python is one of the easier languages to learn. Notice I said “easier” and
not “easy”… that’s because programming is still difficult, but Python reads closer to
the English language than most other languages. This is one of the benefits of learning
Python, because concepts that you learn from this book are still applicable to other
languages. Python is also one of the most sought-after skills in the technology industry
today, used by companies such as Google, Facebook, IBM, etc. It’s been used to build
applications like Instagram, Pinterest, Dropbox, and much more!

3
Chapter 1 Getting Started

It’s also one of the fastest growing languages in 2019, climbing to the top 3 languages
to learn for the future.1 How well does it pay though? According to Indeed.com, the
average salary in 2018 was around $117,000 USD!2 That’s a lot of monopoly money!
One of the biggest reasons for learning Python, though, must be the use of the
language itself. It’s used in several different industries: front-end development, back-end
development, full-stack, testing, data analytics, data science, web design, etc., which
makes it a useful language.

Why This Book?


Let’s start with the main reason for wanting to read this book. The material taught
throughout this book has a proven track record. I’ve personally used this exact
organization approach to help get my students well-paying positions across a variety of
industries. The structure of this curriculum has been repeatedly improved over the years
to stick with current industry trends.
One of the next great strengths of this book vs. its competitors is how the concepts
are taught. I won’t bore you with details; instead we’ll build small- and large-scale
applications together throughout the course of this book. The best way to learn is often
by doing! Especially when it comes to programming, one of the lessons I often tell
students is to just try writing the code, and if it breaks, fix it. You won’t be able to learn if
you don’t try to break things!
Lastly, this book will not only teach you how to program but how to think like a
programmer. At the beginning of each week, I’ll challenge you, and by the end of the
lesson, you’ll be able to understand the approach you need to take. You can always tell
the difference between those who are only able to program and those that are proven
developers.

Who This Book Is For?


It’s always good to understand what you’re getting into before you start reading the book.
To want to read a book, you first must realize if the book itself is designed for you. If you
can answer yes to any of the following questions, then this book is for you:

1
w ww.tiobe.com/tiobe-index/
2
www.indeed.com/salaries/Python-Developer-Salaries

4
Chapter 1 Getting Started

• Do you have experience in other programming languages but want to


pick up a high-level language?

• Have you never programmed before but are eager to learn?

• Did you take computer science courses previously, but they just
didn’t help you learn how to create applications?

• Do you want to make a career change?

• Have you tried to learn languages previously but couldn’t because of


the difficulty of the language?

• Have you programmed in Python before but want to improve your


abilities and learn new tools?

This book is designed for a wide array of readers, no matter your background. The
real question is on you, “How hard are you willing to work?” The concepts taught in
this book can benefit anyone willing to learn. Even if you’ve programmed in Python
before, this book can still help you become a stronger developer.

What You’ll Learn


This book was created to be used for bootcamp classes designed in teaching Python.
You can expect to cover necessary information that would be required of you on the job
as a Python developer. These concepts will give you the ability to go forward with your
education in programming. At the end of each chapter, we’ll use the concepts covered
to create a variety of real-world applications. After all, we’re not just focused on Python
here, we’re trying to build you up to become a better developer.

Tomorrow, we’ll find out how to install the necessary software that this book
uses. If you already have Anaconda and Python on your machine, you can skip to
Wednesday’s lesson.

5
Random documents with unrelated
content Scribd suggests to you:
Monazite has also been observed in the tin-bearing sands of
Embabaan, Swaziland, South Africa, and in the province of Ottawa,
Canada.

CHAPTER VIII

RADIOACTIVITY OF THE MINERALS


In the present chapter no attempt will be made to give a complete
account of all the phenomena of radioactivity which have been
observed in the mineral world. There are, however, a few problems
of the highest scientific interest which centre about the rare earth
minerals, and mention of these can hardly be avoided in a work
which professes to give a general account of the rare earth group. It
is obvious that a detailed treatment cannot be given without
entering into phenomena which would be quite beyond the range of
the present work, and an excuse is hardly needed, therefore, for the
fragmentary and abbreviated account which follows. The reader’s
acquaintance with the general phenomena of radioactivity is of
necessity assumed.
Radioactivity (the spontaneous emission of special radiations) was
first observed by Becquerel, in 1896, in the case of potassium uranyl
sulphate, and was soon found to be common to all uranium
compounds, and to the metal itself. Mme. Curie showed that whilst
in uranium salts the degree of activity varies directly with the
percentage of uranium, in minerals containing the element the same
rule does not hold. The observation that pitchblende is considerably
more active than the uranium it contains led to the discovery of
polonium[125] and radium in 1898. Exactly analogous phenomena
were shown to hold for thorium salts and thorium-containing
minerals by Mme. Curie and Schmidt in 1898, and in 1905 Hahn
separated Radio-thorium from thorianite. In 1899 Debierne
discovered that the rare earths precipitated from the solution
obtained on treatment of pitchblende are associated with another
extremely active body, which he named Actinium; Giesel found that
in the separation of the rare earths this remains with lanthanum. In
1903 Ramsay and Soddy experimentally confirmed the prediction of
Rutherford and Soddy, that radium would be found to produce
helium continuously. The discovery of these remarkable phenomena
has modified many fundamental physical conceptions, and has
opened up a new field of scientific enquiry, which is being developed
with unexampled rapidity.
[125] Polonium, which was named by Mme. Curie in honour of her native
country, has been shown to be identical with Marckwald’s ‘Radio-
tellurium,’ which was named by Rutherford ‘Radium F’; it is one of the
degradation products of radium.
It has been mentioned, in the accounts of the rare earth minerals
given above, that almost all these minerals are radioactive, i.e. have
the property of emitting specific radiations. Moreover, radioactivity,
to any considerable extent at least, is, with a few important
exceptions, confined to the minerals which have been already
described. It has been shown by many investigators, chief amongst
whom are Strutt and Boltwood, that the activity is usually due to the
presence of uranium or thorium, or both.[126]
[126] Hauser and Wirth (Ber. 1910, 43, 1807) observed activity in some
zirconium minerals containing neither thorium nor uranium.
After the discovery of helium in Cleveite (a variety of pitchblende,
vide p. 13) in 1895 by Ramsay, a large number of minerals were
examined for this gas, and it was found that almost all the rare earth
minerals contain helium. The fact that these minerals are also for the
most part radioactive, naturally suggested some relation between
the activity and the presence of helium, and led directly to the
discovery that radium is continuously producing helium; and it
became apparent that helium has been accumulating in these
minerals since their formation, by the decay of radioactive elements.
The question of the origin of helium in minerals will be touched on
again.
In 1904 Boltwood advanced the theory that radium is produced by
the degradation of uranium, the parent-element having, however, a
much greater half-life period. If uranium continuously produces
radium, whilst the latter decays much more rapidly than the former,
it must follow that in minerals containing uranium a state of
equilibrium is reached between uranium and radium, and the ratio of
these two in all minerals should therefore be constant, and
independent of the geological age. Boltwood examined a number of
the minerals of which descriptions have been given in the preceding
chapters, and found the ratio to be surprisingly constant.[127] Strutt
also examined a large number of minerals,[128] and whilst on the
whole his results seemed to support the theory, his values for the
ratio were by no means so constant as those of Boltwood. Strutt
included in his examination the interesting radium-containing mineral
observed by Danne at Issy l’Evêque.[129] This was a pyromorphite
(lead chlorophosphate) containing neither uranium nor thorium.
Danne suggested that the radium was not an original constituent,
but had been introduced by the action of percolating waters. This
view was confirmed by McCoy and Ross,[130] who found that the
activity was entirely confined to the surface layer.
[127] Amer. J. Sci. 1904, [iv.], 18, 97; Phil. Mag. 1905, [iv.], 9, 599.
[128] Proc. Roy. Soc. 1905, A, 76, 88 and 312. Ibid. 1907, A, 80, 56.
[129] Compt. rend. 1905, 140, 241.
[130] J. Amer. Chem. Soc. 1907, 29, 1698.
Mlle. Gleditsch has also examined the question of the uranium-
radium ratio in minerals. Her earlier work[131] gave ratios which,
whilst constant for each mineral species, varied in much the same
manner as Strutt’s for different species, and afforded very little
support to Boltwood’s theory. Her more recent results,[132] however,
are much more closely in accord with the theory, which has been still
further strengthened by the work of Pirret and Soddy[133] and of
Marckwald and Russell.[134] It may now be regarded as firmly
established that radium is in the line of direct descent from uranium.
[131] Compt. rend. 1909, 149, 267; Le Radium, 1909, 6, 165.
[132] Le Radium, 1911, 8, 256.
[133] Phil. Mag. 1911, [vi.], 21, 652.
[134] Ber. 1911, 44, 777.
Boltwood had assumed that the helium in radioactive minerals is
produced from the uranium, during its disintegration. Strutt,
however, disputed this; his experiments showed that very little
helium is found even in the richest radium-uranium minerals unless
thorium is also present. Thus pitchblende contains a very high
percentage of uranium, but relatively little helium (there is usually a
considerable thorium percentage here too, so that nothing
conclusive can be deduced from this). Adams[135] found that
carnotite, a mineral very rich in uranium, but containing no thorium,
contains no helium at all; he explained its absence by the very loose
texture and permeability of the mineral, which would allow the gas
to escape. Strutt concluded that whilst helium is undoubtedly
produced by disintegration in the uranium series, in minerals it is
produced more by thorium or, as more recent work indicates, by
radio-thorium, than by uranium.
[135] Amer. J. Sci. 1905, [iv.], 20, 256.
The question of the origin of helium in minerals is, however, not
definitely settled, for several anomalous cases are known. Thus the
yttria silicate, Thalénite (q.v.), contains quantities of helium, but no
uranium or thorium is given in the analyses. Similarly, Risörite
contains a relatively large quantity of helium, but only traces of
uranium and thorium. In the last mineral, the active constituent is
precipitated with the lead, so that no radio-thorium appears to be
present. Further, Thomsen analysed a fluorspar from Ivitgut in
Greenland which he found to contain 27 c.c. of helium per kilogram.
This specimen contains no uranium, but gives off the thorium
emanation in quantities which suggest the presence of radio-
thorium; moderate quantities of thorium are also present. Since the
α particle has been definitely identified as a positively charged
helium atom, it appears certain that disintegration in all three series
(uranium, actinium, and thorium series) produces helium, and a
mineral containing a member of any of these series (which gives α
rays or α ray-giving products) would also contain helium.
Even so, there is a case in which the helium content is anomalous,
if not altogether beyond explanation at the present stage. In
examining a large number of minerals for helium, Strutt[136] found
that some samples of beryl, a beryllium aluminium silicate, contain a
relatively very large amount of helium, but only traces of thorium,
and was altogether inactive. The absence of any active constituent
renders untenable the ordinary explanations of the presence of such
a surprising quantity of helium. Boltwood has put forward a
suggestion which in the present state of our knowledge must be
regarded as a provisional explanation. He conceives that in the
concentration of beryllium from the parent magma, it may have
become associated with some short-lived intermediate radioactive
element, which had been altogether separated from its long-lived
parent element in the process of concentration; this intermediate
element, having collected in the crystallised beryl, decayed
completely in the course of the great period which must have
elapsed, leaving the helium to which it had given rise during its
disintegration enclosed in the mineral. It is difficult to see how two
substances which must be so intimately connected as a parent-
element and its product could be completely separated in the
process of cooling of a magma; but since so little is known of the
process of crystallisation of minerals, the suggestion can hardly be
rejected on geological grounds. In any case, we have here only one
strongly marked exception to the very definite rule that in all cases
in which helium occurs in minerals, it is accompanied by and
undoubtedly produced from, a radioactive element or elements; and
in the majority of cases, the helium in minerals is produced by
disintegration of uranium or thorium and their products.
[136] Proc. Roy. Soc. 1908, A, 80, 572.
Strutt found that traces of helium are universal in the mineral
world. His method of determining helium was approximate only. He
obtained the gas content by heating the powdered mineral—a
method which, as Wood has shown,[137] will only give all the gas
when very high temperatures (up to 1000°C.) are employed. The
gases were freed from oxygen and hydrogen by passing over a
heated, partially oxidised, copper spiral, and from carbon dioxide by
means of potash. Nitrogen was removed by sparking with excess of
oxygen and shaking over potash; the excess of oxygen was removed
by melted phosphorus. The inert gases so obtained were freed from
all impurities by the use of the liquid alloy of sodium and potassium
for the electrodes of the spectrum tube in which the gases were
examined spectroscopically.[138] Argon, if present—it seems to be a
universal constituent of igneous rocks, into which it may have been
absorbed from the air—was removed by charcoal at a temperature
of -80°C. The helium so left was examined spectroscopically, and
measured in a MacLeod gauge.
[137] Proc. Roy. Soc. 1910, A, 84, 70.
[138] As soon as the discharge is started in such a tube, all the gases
present other than those of the helium family are absorbed by these
electrodes.
As stated, helium was found in traces in nearly all minerals, and its
presence is to be attributed to traces of radium, which also appears
universal. In minerals containing uranium or thorium, or rare earths
(the latter are almost always accompanied by uranium and thorium),
helium is found to a much greater extent, and Ramsay considers it
possible that some fraction of the helium content may arise from the
rare earth metals. There is, however, no positive evidence to support
the conjecture. He found that the helium ratio, i.e. the volume of
helium per gram of uranous oxide, UO₂, varies with the amount of
thoria present; but where the latter is absent the variations are
much less marked. If helium were produced in a mineral from
uranium alone, and none escaped, it is obvious that the helium ratio
would depend only on the age of the mineral. For minerals of about
the same age, and containing no thorium, the helium ratio would be
roughly constant, if no disturbing factor required consideration.
In 1905 Strutt pointed out that in all the minerals he had
examined, thorium was never present unless accompanied by
uranium and radium, whilst uranium and radium often occurred
without thorium. He suggested that the present atomic weight of
thorium, 232·5, was too low, and that it was really the parent of
uranium (at. weight 238·5); he further supposed that the next
permanent member in the line of descent was one of the cerium
metals. These suggestions have been negatived by later work of
Boltwood and Holmes. The former pointed out[139] that it was far
more likely that thorium is a disintegration product of uranium of
considerably longer life. On the whole, however, there is very little
positive evidence to connect thorium with uranium.
[139] Boltwood, Amer. J. Sci. 1905, [iv.], 20, 256.
In the same year Boltwood (loc. cit.) drew attention to the
persistent appearance of traces of lead, bismuth, barium, etc., in the
radioactive minerals, and also pointed out that the variations of the
ratio of helium to uranium in pitchblende might be used to
determine the age of the mineral. In 1907 he suggested[140] that
lead was the final product of the degradation of uranium, from which
it follows that the ratio of uranium to lead should be constant for
minerals of the same age (since, lead decays, if at all, at an infinitely
slower rate than uranium). He collected all the available analyses,
and classified the minerals dealt with into six groups according to
the value of the ratio. The order given by the ratio was declared to
be in accordance with the order of age as given by geological
evidence.
[140] Amer. J. Sci. 1907, [iv.], 23, 77.
Holmes[141] has further extended this work. He examined a
number of rare earth and allied minerals from the Christiania district,
which Brögger considers to be of approximately Lower Devonian
age, and found the ratio of lead to uranium to approximate quite
closely, for almost all the minerals examined, to 0·045. Representing
the change in the usual way as

U → 8He + Pb
238·5 → 31·92 + 207·1
and using the data calculated by Rutherford and others for the rates
of decay, he gives the age of Lower Devonian strata as about 370
million years. This figure is about twice as great as that deduced by
palæontologists from the flora and fauna, and greater still than the
times based on physical data, e.g. rates of cooling, precession and
nutation, etc. His figures for pre-Cambrian rocks, based on the same
ratio, range between 1000 and 1640 million years, the later being
deduced from a thorianite from the Archæan rocks of Ceylon.
Strutt’s figure for Archæan rocks is about 700 million years; this was
derived from work on the helium ratio, which must now be
considered.[142]
[141] Proc. Roy. Soc. 1911, A, 85, 248.
[142] See Strutt, Proc. Roy. Soc. 1908, A, 82, 166; 1909, 83, 96; 1909,
83, 298; 1910, 84, 194.
In 1898 Travers[143] had examined the effect of heat on cleveite
and fergusonite, and found that about half the total helium, together
with hydrogen, is given off at a bright red heat. He considered it
likely that the helium was combined with a metal (though he
recognised no distinction between occlusion and combination) and
remarked: ‘The results of such experiments cannot therefore serve
as a basis for speculation as to the origin or history of the
substances in question.’ The chemical inactivity of helium, however,
as well as the experiments of Moss and Gray, who showed that
helium was evolved on grinding the materials,[144] indicate that the
gas is mechanically bound only. This, however, introduces the
difficulty, if an attempt be made to use the helium-uranium ratio to
calculate the age of minerals, that the gas would be expected to
escape from a porous material, so that its amount is never so great
as it should be. Strutt himself found that helium escapes rapidly from
powdered monazite, whilst even the solid mineral was found to
evolve helium at a rate much in excess of the probable rate of
production by radioactive changes. Similar results were found with
thorianite, and the only conclusion, since helium is found in the
minerals, is that under the conditions under which these minerals
exist in the earth’s crust, this escape is checked or altogether
prevented. It follows, however, that any age determined from the
helium ratio must be a minimum age, since there is always the
chance of loss; this of course is not the case—except where the
minerals have suffered chemical changes—with the lead ratio, and
may account for the discrepancies observed.
[143] Proc. Roy. Soc. 1898-99, 64, 140.
[144] Vide Gray, Proc. Roy. Soc. 1908, A, 82, 306.
Strutt’s earlier work on the helium ratio was made with phosphate
minerals (coprolites and fossil bones) of known ages. The ratios
found were not in order of age, the minerals being very permeable,
so that helium had probably been lost. He next turned his attention
to igneous rocks, and selected zircon for the work. Here he obtained
some sort of regularity in the order of age and the order given by
the ratio, and assumed that if helium were lost at all, it must be lost
in roughly proportional amounts by reason of the similarity in
conditions. Geological criticism tends to lessen the trustworthiness of
the conclusions; it is pointed out that the age of a specimen of
zircon is not necessarily that of the rock in which it occurs, for zircon
is an extremely stable mineral, and might survive unchanged several
fusions and re-crystallisations of the magma. Strutt replies to this
that at the temperature of fusion of a rock, zircon would certainly
give up its accumulated helium, so that the age determined from the
helium content would be that of the last fusion, i.e. the age as given
by geological data. On the other hand, our ignorance of the real
mechanism of the crystallisation of a magma, and especially of the
amount and effect of the pressures obtaining, robs this reply of its
force, and the objection must be counted valid.
In still later work Strutt used sphene and thorianite, and his
results agree as well as can be expected. The sphenes used were all
from Archæan rocks, except one, which was from a Tertiary volcanic
deposit of the Laacher See, near Coblenz (the lake is in the crater of
an extinct volcano). In this case the helium ratio was very much
smaller (about 1⁄4000 of the values for Archæan rocks) indicating the
(comparatively) extremely recent formation of the deposit.
The most recent results in the study of radioactivity point to the
conclusion that elements which differ in atomic weight and
radioactive properties may be chemically identical, or at least
chemically inseparable; such elements have been termed isotopes.
The end product of the thorium series of radio-elements should have
an atomic weight of about 208·4, and it has been suggested that the
element actually produced in this series of changes may be bismuth.
The latest results, however, rather point to the conclusion that
disintegration in the thorium series gives rise to an isotope of lead. If
this hypothesis be true, the lead derived from a mineral rich in
thorium and poor in uranium should have an atomic weight
appreciably higher than that of ordinary lead. Experiments to test
this conclusion have recently been carried out by Soddy and Hyman.
[145]

[145] Proc. Chem. Soc. 1914, 30, 134.


These authors have made analyses of Ceylon thorite, which they
find to contain 0·35 per cent. of lead; from the ratio of thorium to
uranium in the mineral, they calculate that the lead should have an
atomic weight of 208·2, that of ordinary lead being 207·1.
Preliminary comparative experiments on 1 gram of pure lead chloride
extracted from the mineral point to an atomic weight for the thorite
lead of 208·4, a result surprisingly in accord with theory. More
extended experiments on this most interesting question are in
progress.
The present chapter would be incomplete without a reference to
the interesting work of Goldsmidt on radioactivity as an aid in
identifying mineral species.[146] He describes a simple method by
which the activity of a mineral may be rapidly and easily measured
to a sufficient degree of approximation, and shows how the
determination enables a line to be drawn on a diagram already
mapped out; this line will intersect an area on the diagram which
corresponds to the particular mineral. Owing to lack of analytical
data, and to the great difficulty of determining with accuracy small
quantities of uranium and thorium, the method is at present of
scientific interest only; but it is capable of development, and its
development would be of undoubted value in the further study of
this branch of radioactivity.
[146] Zeitsch. Kryst. Min. 1907-8, 44, 545; ibid. 1908, 45, 490.
In order to make this part of the subject as clear as possible, the
chief points in this chapter are summarised as follows:
1. Radioactivity is only observed to an appreciable extent in some
rather rare minerals. These minerals as a rule contain radium,
uranium, thorium, rare earths, and helium.
2. The helium has been produced during geological time by the
degradation of one or more members of the three series of active
elements (the Uranium, Actinium, and Thorium series).
3. Radium is a degradation product of uranium, and itself is
degraded continuously; the final product of degradation is probably
lead.
4. The age of minerals has been calculated from the ratio of lead
to uranium; the figures obtained are much greater than those put
forward by geologists and physicists.
5. The helium ratio has also been used, but appears less
trustworthy, owing to escape of helium, and uncertainty as to
geological age of the minerals employed.
6. Some connection between radioactivity and the presence of the
yttrium or cerium metals appears highly probable, but no
satisfactory theories have been advanced on this point; it has been
shown that actinium is very closely allied to lanthanum.
PART II

THE CHEMISTRY OF THE ELEMENTS

CHAPTER IX

GENERAL PROPERTIES OF THE CERIUM AND


YTTRIUM GROUPS
The chemistry of the rare earth elements begins in the year 1794,
with Gadolin’s discovery of the new oxide ‘Ytterbia,’ for which the
name Yttria was subsequently proposed by Ekeberg, and generally
adopted (see Chapter I, and under Gadolinite, p. 35). The discovery
of Ceria followed in 1804 (see under Cerite, p. 32). The classical
work of Mosander, carried out between 1838 and 1842, showed the
complex nature of the new oxides. From ceria he separated three
new earths, Ceria proper, Lanthana, and Didymia. Yttria was shown
to be a mixture of at least three oxides, for which the names Yttria,
Erbia, and Terbia were proposed. These oxides were believed to
have the general formula RO, by analogy with the alkaline earths,
which they were found to resemble in many respects, notably in
their strongly basic character.
The properties of the new oxides were examined during the next
twenty years by many chemists, the chief workers being Marignac,
Rammelsberg, and Hermann, but the next important advance was
the investigation of the absorption spectra of solutions of the rare
earth salts, first suggested by Gladstone in 1856, and developed
more fully by Bunsen and Kirchhoff in 1860 and the following few
years. The introduction of the methods of spectrum analysis
furnished a very delicate and valuable method of examining and
identifying the various oxides, and so greatly assisted the laborious
processes of separation.
Sixteen elements (excluding thorium and zirconium) are at the
present time recognised as belonging to the rare earth group. With
one or two exceptions, these show the closest resemblance to one
another, both in chemical behaviour and in the properties of their
compounds, so that the difficulties of separating and purifying them
are very great. They may be said to form a series, in which the
properties vary continuously but gradually from member to member,
so that no sharp differences are anywhere perceptible. The method
of division into groups is, therefore, almost entirely one of
convenience, and has arisen from the course which the separations
have followed.
The elements are divided into two chief families or groups, that of
the cerium metals and that of the yttrium metals respectively. The
cerium elements are separated by a process depending on the
relative insolubility of their alkali double sulphates; in this group are
included cerium, lanthanum, praseodymium, neodymium, and
samarium. The yttrium family is further divided into four sub-groups:
the first consists of scandium and yttrium; the second or terbium
group of europium, gadolinium, and terbium; the third or erbium
group of dysprosium, holmium, erbium, and thulium; and the fourth
or ytterbium group of ytterbium and lutecium—the element celtium,
recently discovered by Urbain, will also fall into this sub-group, but
the discovery awaits confirmation. Whilst scandium and yttrium fall
into somewhat abnormal positions, corresponding to their low
atomic weights, the terbium elements occupy an intermediate
position between the cerium elements and the remaining yttrium
elements, or yttrium group proper, and so are frequently classified as
a third or intermediate group.
This list does not include all the names which have been put
forward to designate what have been claimed from time to time as
new elements; whilst the individuality of some of those included is
not yet fully established, and the homogeneity of others has been
called in question. The uncertainty is more pronounced among the
yttrium elements than among the cerium elements; owing to the
opportunities for investigation furnished by the commercial
treatment of monazite, the chemistry of the cerium group may be
regarded as complete.
In the following table the elements are arranged in order of
increasing atomic weight, and it can be seen at once how closely the
division into groups follows this order:
Atomic
Element Colour of Salts
Wt.
Scandium, Sc 44·1 Colourless
-
Yttrium, Yt 89·0 Colourless

Lanthanum, La 139·0 Colourless


Cerium, Ce 140·25 Cerous, colourless;
ceric, orange to red
Cerium
- Praseodymium, 140·6 Green
Group.
Pr
Neodymium, Nd 144·3 Red to reddish-violet
Samarium, Sa 150·4 Topaz yellow

Europium, Eu 152·0 Faint rose


Terbium
- Gadolinium, Gd 157·3 Colourless
Group.
Terbium, Tb 159·2 Colourless

Dysprosium, Dy 162·5 Bright green


Erbium Holmium, Ho 163·5 Yellow to orange
-
Group. Erbium, Er 167·7 Deep rose
Thulium, Tm 168·5 Bluish-green

Ytterbium Ytterbium, Yb 172·0 Colourless


-
Group. Lutecium, Lu 174·0 Colourless

In their chemical relations, the rare earth elements may be placed


between the metals of the alkaline earths, and the trivalent metals
iron, aluminium, and chromium. With the exceptions of cerium in the
ceric salts, and of samarium and europium in the recently discovered
dichlorides, they are uniformly trivalent, but the oxides are very
strong bases, and the salts very slightly hydrolysed in dilute
solutions; generally, therefore, they resemble the calcium family
rather than the aluminium group. Among the common salts, the
oxalates, phosphates, chromates, iodates, fluorides, carbonates,
tartrates, and borates are almost insoluble; the sulphates are only
sparingly soluble at ordinary temperatures. Among the double salts,
the alkali double sulphates are of great importance from their
employment for separations; the tendency to the formation of
complex salts is greater among the yttrium than among the cerium
elements, increasing with the atomic weight, and with the decrease
in basic strength of the oxides.
The great similarity in chemical behaviour of the rare earth
elements is apparent not only in the similarity in composition,
solubility and chemical properties of the salts—which is so great that
the general account of the compounds which follows applies almost
in its entirety to each member of the group—but also in the
crystallographic relations between corresponding compounds. Many
of the salt hydrates form isomorphous series; the sulphate
octohydrates, for example, appear to be isomorphous throughout
the whole group, and probably the relation would be found to apply
even more completely than is generally accepted, if the necessary
data were forthcoming. Of great interest and practical importance is
the isomorphism between the nitrates and double nitrates of the
cerium elements and bismuth, which has been utilised with such
valuable results in the processes of fractional crystallisation.

The Metals. —The earlier attempts to reduce compounds of the


rare earth elements to the metallic condition, by means of metallic
sodium or potassium, did not yield pure products; nor did the use of
aluminium or magnesium lead to results of practical importance. The
metals were first obtained in a coherent physical condition by
Hillebrand and Norton,[147] by electrolysis of the fused chlorides.
These investigators obtained cerium, lanthanum, and the so-called
didymium, and measured their specific heats; their results confirmed
the atomic weights assigned to the elements by Mendelejeff, except
in the case of lanthanum. Their method has since been elaborated
by Muthmann, Hofer and Weiss,[148] who have prepared large
quantities of the cerium elements in the pure state. More recently,
Hirsch has prepared metallic cerium in large quantities,[149] and has
studied its properties.
[147] Pogg. Ann. 1875, 155, 631; 156, 466.
[148] Annalen, 1902, 320, 231; see also Muthmann and Weiss, ibid. 1904,
331, 1.
[149] Met. Chem. Eng. 1911, 9, 543.
By electrolytic reduction of the mixed chlorides of the cerium
elements, a mixture known as ‘Misch metal’ is obtained; this has
powerful reducing properties, and, like aluminium, reduces the
oxides of iron, chromium, etc., with great development of heat.[150]
The yttrium metals have not yet been obtained in the pure state, the
electrolytic method giving unsatisfactory results on account of the
high melting-points of the metals, and the volatile nature of their
chlorides.
[150] A full account of the properties and preparation of the cerium metals
and their alloys will be found in the monograph of Kellermann, ‘Die
Ceritmetalle und ihre pyrophoren Legierungen, Wilhelm Knapp, Halle,
1912.
The cerium metals are white or slightly yellowish in colour, and are
moderately stable in dry air. In moist air they tarnish slowly,
lanthanum, as the most positive, being most readily oxidised. The
melting-points and specific gravities are as follows:
Melting- Specific
Element
point Gravity
Cerium 623° 7·0242
Lanthanum 810° 6·1545
Praseodymium 940° 6·4754
Neodymium 840° 6·9563
Samarium 1300°-1400° 7·7-7·8
The metals decompose water slowly in the cold, but rapidly at the
boiling-point, with evolution of hydrogen. They have a great affinity
for oxygen, the heats of formation of the oxides being of the order
of those of alumina and magnesia:
Heat of Formation
per Equivalent Weight
of Oxide[151]
1
⁄3La₂O₃ 74·1 K
1
⁄3Nd₂O₃ 72·5 „
1
⁄3Pr₂O₃ 68·7 „
1
⁄4CeO₂ 56·1 „
1
⁄3Al₂O₃ 64·3 „
1
⁄2MgO 71·9 „
[151] Muthmann and Weiss, loc. cit.; K = 1 kilogram-calorie, or 1000 cal.
In consequence of the high values of the heats of combustion, the
metals have powerful reducing properties.
The cerium metals form alloys with magnesium, zinc, aluminium,
and iron, and combine with boron and silicon. The alloys of cerium,
and the metal itself, are remarkable for their property of emitting
brilliant sparks when scratched (see Chapter XXI). Cerium also forms
an amalgam with mercury.
The metals burn brilliantly when heated in oxygen, and dissolve
readily in dilute mineral acids. When heated to a temperature of
200°-300° in a current of hydrogen, they absorb the gas very
readily, forming the hydrides. These compounds are also obtained by
heating the oxides with magnesium in a current of hydrogen. They
were first prepared by Winkler,[152] who deduced from his analyses
the general formula RH₂; the more recent work of Muthmann and
Beck,[153] however, points to the formula RH₃.
[152] Ber. 1890, 23, 2642; 1891, 24, 873.
[153] Annalen, 1904, 331, 58.
If nitrogen be substituted for hydrogen in either of the above
methods of preparation, nitrides of the general formula RN are
obtained; cerium nitride, however, cannot be obtained by heating
the element in the gas.[154] These compounds are also obtained
when the carbides are heated in ammonia. They are amorphous
solids, which yield ammonia when acted upon by water.
[154] Dafert and Miklanz, Monats. 1912, 33, 911.

Hydroxides. —The hydroxides are thrown down as gelatinous


precipitates on the addition of alkalies to hot dilute solutions of the
salts; precipitation in the cold, or in strong solution, usually gives a
basic salt, or an hydroxide mixed with a large quantity of basic salt.
The hydroxides are insoluble in excess of precipitant, but the
precipitation is inhibited by the presence of some organic hydroxy-
acids.[155]
[155] For effect of tartaric acid, see p. 133.
The hydroxides are insoluble in water, but dissolve very readily in
acids. The most basic of them absorb carbon dioxide from the air;
lanthanum hydroxide is exceptional in that it colours litmus blue.
Whilst hydrogen peroxide in neutral solution does not react with
rare earth salts,[156] alkalies in presence of this reagent precipitate
gelatinous hydrated peroxides, which are very unstable,
decomposing on standing, or on treatment with acids, with evolution
of oxygen. The general formula R₄O₉ + xH₂O was proposed for
these compounds by Cleve, but more recently the formula R(OOH)
(OH)₂ has been advanced.[157]
[156] Compare behaviour of thorium and zirconium, Ch. XVI.
[157] Melikoff and Pissarjewski, Zeitsch. anorg. Chem. 1899, 21, 70;
Melikoff and Klimento, Chem. Zentr. 1902, 1, 172.

Oxides. —In their most stable state of oxidation, the rare earth
elements are generally trivalent. In the case of cerium, the dioxide,
CeO₂, is more stable than the sesquioxide Ce₂O₃, but the ceric salts
are unstable, and are very readily reduced to cerous compounds,
corresponding to the oxide Ce₂O₃. Higher oxides are known with
certainty among the other elements only in the cases of
praseodymium and terbium, but these do not give rise to salts.
The oxides R₂O₃ are fairly strong bases, being comparable in
strength to the alkaline earths, and far more strongly basic than
alumina and oxides of other trivalent elements; thus they liberate
ammonia from ammonium compounds, whilst the salts they form
with strong acids are not easily hydrolysed. Their relative strengths
as bases are expressed in the following series, in which the elements
are placed in order of diminishing electropositive character:[158]
La, Ce´´, Pr, Nd, Yt, Eu, Gd, Sa, Tb, Dy, Ho, Er, Tm, Yb, Lu, Sc, Ceiv.
[158] The position of yttrium in this series is not known with certainty; it is
probably as positive as neodymium. It is usually stated (see Meyer and
Hauser, pp. 32-33) that the terbia oxides are intermediate in basic
strength between the ceria and yttria earths, though the arrangement
into two series, consisting of the cerium and yttrium groups
respectively, is generally adopted; the electropositive character of the
elements in each series then weakens as the atomic weight rises,
scandium being of course exceptional.
It will be seen that, with the exception of scandium and yttrium,
the metals of the cerium and yttrium groups become less
electropositive as the atomic weight increases.
This arrangement is obtained by ascertaining the order in which
the various hydroxides are precipitated from a solution by gradual
addition of a dilute solution of a strong base. The weakest base is
precipitated first, and the strongest last; those intermediate in
strength are thrown down in ascending order of strength. Similar
results may be obtained by the fractional decomposition of the
nitrates by heat; in this case the nitrate of the weakest base is
decomposed at the lowest temperature. This order is also confirmed,
as far as the data are available, by measurements of the equivalent
conductivities of solutions of the salts (see, for example, p. 122).
Quite recently, a very different order has been obtained from a
consideration of the dissociation tensions, and of the heats of
dissociation of the anhydrous sulphates.[159] In the following table
the elements are arranged in the order of the increase of the
dissociation tension (T) measured at 900°, which is the same as the
order of decrease of the heats of dissociation (Q):
Element At. Wt. T. (Mm. Hg.) Q.
La 139 ·0 2 59·8
Yt 89 ·0 3 58·9
Lu 174 ·0 3 ·5 58·5
Yb 172 ·0 4 58·2
Er 167 ·7 5 57·6
Pr 140 ·6 5 ·5 57·4
Nd 144 ·3 6 57·2
Gd 157 ·3 7 56·9
Sa 150 ·4 8 56·5
Sc 44 ·1 11 54·5
Ce 140 ·25 52·4
[159] Wöhler and Grünzweig, Ber. 1913, 46, 1726.
It will be observed that the order is very different from the order
of increase of atomic weight, the positions of lutecium and ytterbium
being especially surprising; these elements are generally considered
to be among the least electropositive of the whole series. The
anomalous position of cerium is probably due to the fact that the
sulphate on decomposition leaves the dioxide, and not the
sesquioxide, as with the other elements; this would undoubtedly
affect the values. The heats of dissociation are the greatest yet
observed for the sulphates of trivalent metals, a further evidence of
the strongly basic nature of the oxides.
Ignited lanthana resembles quicklime in that it readily absorbs
carbon dioxide from the air, and hisses when slaked with water; as
the basicity becomes weaker, the affinity for water and carbon
dioxide becomes less marked. All the oxides are soluble in dilute
acids, even after prolonged ignition; but the ease with which
solution occurs is naturally much influenced by the treatment to
which the oxide has been subjected, as well as by its strength as a
base.
The rare earth oxides are capable of existing in more than one
modification, the compounds obtained by ignition of the hydroxides
differing in appearance and reactivity from those prepared by
ignition of the oxalates or nitrates, and so on; they are probably
highly polymerised. Cerium dioxide, CeO₂, is remarkable for its
power of combining with the other oxides, R₂O₃, of the rare earth
metals. The pure dioxide is insoluble in nitric acid, but mixtures of
earths containing up to 50 per cent. of the dioxide dissolve readily.
The various colours of mixtures of the ceria earths may sometimes
be attributed to a similar combination,[160] and there can be little
doubt that the dioxide sometimes functions as an acid in the rare
earth minerals.
[160] The brown colour of a mixture of ceria oxides containing
praseodymium is generally attributed to the presence of the strongly
coloured peroxide of that element.

Sulphides. —These compounds cannot be prepared in the wet


way, that is, by the action of hydrogen sulphide or ammonium
sulphide on the salts in solution; the former reagent gives no
precipitate, the latter throws down the hydroxides. In this behaviour,
the rare earth elements resemble aluminium and chromium.
The normal sulphides, R₂S₃, are obtained by reduction of the
anhydrous sulphates, or from the oxides at high temperatures, by
treatment with hydrogen sulphide. They are strongly coloured
compounds, fairly stable towards cold water, but readily hydrolysed
on boiling.
Disulphides, RS₂, are known in the cases of cerium, lanthanum,
and praseodymium; these are to be regarded as polysulphides, since
on treatment with dilute acids they yield hydrogen persulphide,
H₂S₂.

Carbides.
—By reduction of the oxides with carbon in the electric furnace,
Moissan obtained the carbides in the form of microscopic yellow
crystals. They have the general formula RC₂, and are attacked by
water and dilute acids, with evolution of very complex mixtures of
gases.[161] The principal product is acetylene, with various higher
homologues, and in smaller quantities ethylene and ethane and their
homologues. No methane is formed,[162] but hydrogen is always
present, the olefines and paraffins probably arising from its action on
the acetylenic hydrocarbons. The relation of the rare earth elements
to the calcium group is here very close; calcium carbide when
attacked by water yields pure acetylene, whereas aluminium carbide
gives pure methane.
[161] Damiens, Compt. rend. 1913, 157, 214.
[162] Moissan stated that 24-30 per cent. of methane was formed in this
action; compare Compt. rend. 1900, 131, 595.

Halogen Salts. —The halides of the rare earth elements show a


close analogy with the corresponding compounds of the alkaline
earth elements. The fluorides are insoluble in water and dilute
mineral acids, and are obtained as gelatinous precipitates by the
addition of hydrofluoric acid, or a soluble fluoride, to solutions of the
salts. They may be prepared in the crystalline condition by heating
the carbides in a stream of fluorine, or by the action of hydrofluoric
acid upon the hydroxides in aqueous suspension. The rare earth
elements, as well as thorium, may be separated from zirconium by
taking advantage of the insolubility of their fluorides in excess of
hydrofluoric acid or alkali fluorides, since zirconium fluoride is readily
soluble in excess of the precipitant. The solubility of the fluorides in
a large excess of concentrated acid increases with the electropositive
character of the metal, the fluorides of the more negative elements
being the least soluble. Thorium and scandium may, therefore, be
concentrated to a large extent by repeated precipitation with
hydrofluoric acid in acid solution.
The silicofluorides of the rare earth elements have been used by
R. J. Meyer in the extraction of scandium from wolframite (see
Chapter I and under Scandium, p. 215). They are thrown down as
gelatinous precipitates on addition of potassium or sodium
silicofluoride to boiling, neutral solutions of rare earth salts. In
presence of mineral acids, however, they are not thrown down in the
cold; on boiling, the cerium metals are precipitated as fluorides, by
hydrolysis of the silicofluorides—the yttrium elements, with the
exception of scandium, being held in solution by the mineral acid.
With the exception of the fluorides, the halogen salts of the rare
earth metals are readily soluble in water, and crystallise from the
concentrated solutions in the hydrated form. The bromides and
iodides have not been so fully studied as the chlorides; they are
hygroscopic salts, and decompose rather easily. The iodides have
been obtained by Moissan in the anhydrous state, by the action of
iodine vapour on the carbides at high temperature.
The anhydrous chlorides may be obtained by the application of
any of the ordinary methods, e.g. by heating the oxides with carbon
in a stream of chlorine, by heating the carbides in the same gas, by
heating the sulphides or hydrated chlorides in hydrogen chloride, or
by evaporating the solutions of the hydrated salts to dryness in
presence of ammonium chloride, and then igniting till the latter has
all been removed. As obtained by any of these methods, they are
fusible at a red heat, but only slightly volatile; they are easily soluble
in water or alcohol, with disengagement of heat. They are insoluble
in most organic solvents, but dissolve to some extent in some bases;
the chlorides of the yttrium elements, for example, are readily
soluble in pyridine. With such solvents, the chlorides form
compounds which may be considered as derived from the hydrated
forms, by replacement of the so-called water of crystallisation by the
organic base.
Conductivity measurements show that the salts are not perceptibly
hydrolysed in moderately dilute aqueous solutions, though the
values for the equivalent conductivities vary somewhat with the
variations in the electropositive character of the elements. In the
following table, the equivalent conductivities of the chlorides in
solutions of dilution 32 and 1024 at 25°C. are given. It will be seen
that the value (λ₁₀₂₄ - λ₃₂) ÷ 10 is in all cases (except for the highly
hydrolysed scandium salt) very close to 3, an experimental proof of
the trivalent nature of the elements. The values for the chlorides of
iron, aluminium and chromium are included; it will be seen that
these elements are considerably less positive than the rare earth
metals (with the exception, of course, of scandium).
Salt λ₃₂ λ₁₀₂₄ λ₁₀₂₄ - λ₃₂
LaCl₃ 105·8 131·5 25·7
CeCl₃ 107·8 135·2 27·6
PrCl₃ 105·5 135·9 30·4
NdCl₃ 103·8 134·3 30·5
YtCl₃ 98·8 123·4 24·6
YbCl₃ 107·4 140·4 33·0
ScCl₃ 116·9 257·9 141·0
AlCl₃ 99·9 138·0 38·1
CrCl₃ 98·4 152·6 54·2
FeCl₃ 117·2 200·7 83·5
From aqueous solutions the chlorides crystallise with six molecules
of water, except praseodymium chloride, which has seven. The
hydrated salts, when heated to 120° in the air, form insoluble
oxychlorides of the general formula ROCl.
The chlorides do not show a great tendency to form double salts
with other metallic chlorides; on the other hand, they readily form
complex compounds with the chlorides of the less electropositive
metals, e.g. tin, bismuth, gold, and platinum.
Subchlorides of samarium and europium have recently been
obtained; in these compounds, for the first time, rare earth metals
have been shown to be capable of functioning as divalent elements.
Cyanides of the rare earth elements are not known; addition of
potassium cyanide to solutions of the salts throws down the
hydroxides. The platinocyanides may be obtained by double
decomposition of the sulphates with barium platinocyanide. They are
very stable and characteristic bodies, of the general formula
R₂[Pt(CN)₄]₃, with 18 or 21 molecules of water. The compounds of
the cerium elements are yellow, with a strong blue fluorescence;
they crystallise in the monoclinic system. The platinocyanides of the
yttrium metals are red or crimson, with a splendid green
fluorescence, and crystallise in the rhombic system. Scandium
platinocyanide is of great interest from the fact that it exists in two
modifications, which show the characteristic appearance of the two
groups of compounds respectively.
Potassium ferrocyanide precipitates potassium earth ferrocyanides
of the general formula KR(FeC₆N₆),3H₂O, from neutral solutions;[163]
the precipitate is somewhat soluble in excess. The ferrocyanides
have been proposed for the purification of yttrium; the method is
useful where rapid concentration of the element is required, yttrium
ferrocyanide being far more soluble than the analogous compounds
of the erbium and ytterbium metals, but the precipitates are
gelatinous, and very difficult to handle.
[163] Compare Astrid Cleve, Zeitsch. anorg. Chem. 1902, 32, 129.

Halogen Oxy-salts. —Perchlorates and periodates of the rare


earth elements, of the general formula R(XO₄)₃,xH₂O, have been
obtained. The existence of chlorates has been observed only in the
yttrium group; yttrium chlorate, Yt(ClO₃)₃,8H₂O, has been prepared
by double decomposition of the sulphate with barium chlorate. The
bromates are also prepared in this way. They are readily soluble
compounds, of which several hydrated forms are known. They are of
considerable importance for purposes of separation in the yttrium
group.
The iodates are sparingly soluble bodies, precipitated by addition
of the alkali compound to solutions of the rare earth salts. The rare
earth iodates are soluble in nitric acid, the solubility increasing as the
electropositive character of the element becomes stronger. A method
for the purification of yttrium has recently been based upon this
property of the iodates, whilst the fact that thorium iodate is
completely insoluble in nitric acid allows of the easy separation and
estimation of thorium in minerals or mixtures containing rare earth
elements.

Sulphates. —The sulphates of the rare earth elements are


obtained by dissolving the oxides or hydroxides in sulphuric acid.
From the solutions so obtained, various hydrated salts separate
according to the temperature of crystallisation. By heating the
hydrated salts to a temperature of 300°-400°, the anhydrous salts
are prepared. These are extremely soluble in water at 0°, having a
great tendency, which is indeed to be observed in the hydrated
forms also, to form supersaturated solutions. When the temperature
of such a solution is allowed to rise, larger or smaller quantities of an
hydrated form separate out, the differences of solubility among the
sulphate hydrates of the various elements being sometimes
considerable.
The hydrated sulphates of the cerium elements have been very
closely studied in connection with the purification of thorium. Cerium
sulphate itself forms hydrates with 12, 9, 8, 5, and 4 molecules of
water, but sulphates of the other elements generally form fewer
hydrates; the commonest have 12, 8, or 4 molecules of water, and
numerous cases of isomorphism are known among them. The
solubility curve of the cerium sulphate hydrates is shown in the
diagram. Fig. 3. The sulphates of the yttrium elements have not yet
been systematically investigated, and in most cases only the
octohydrates are known. Scandium sulphate is notably different from
the other sulphates, in that it is considerably more soluble, and
crystallises with six molecules of water.
Fig. 3.

It is an important characteristic of the rare earth elements that the


solubility of the sulphates diminishes rapidly as the temperature
rises. The study of the various equilibrium conditions is greatly
complicated by the tendency to form supersaturated solutions, and
the fact that many hydrates can exist throughout considerable
ranges of temperature in the metastable condition; in consequence
of this, also, the solubilities of many hydrates are known for
temperatures far beyond the transition points. Foreign elements may
be separated by taking advantage of the very great solubility of the
anhydrous sulphates at 0°, and the rapid decrease in solubility with
rise of temperature. For this purpose, a solution of the anhydrous
sulphates saturated at 0° is prepared, and after filtration is slowly
allowed to come to room temperature; the hydrated rare earth
sulphates then separate, leaving in solution the foreign sulphates.
This method may indeed be used instead of the oxalate separation
(see p. 147).
In presence of excess of sulphuric acid, acid sulphates of the
general formula R(HSO₄)₃ are formed. These are fairly stable, and
must be heated to a temperature of 400°-500° to decompose them
completely to the normal salts; even at that temperature, traces of
acid are tenaciously retained, a fact which renders the determination
of the equivalents by the sulphate method unreliable, unless special
precautions are taken. On further heating, the normal sulphates pass
into basic salts, R₂O₃,SO₃, and finally, at the temperature of the
blowpipe flame, into the oxides. The temperatures at which these
decompositions occur vary with the positive character of the
elements; the most basic oxide clings most tenaciously to sulphuric
anhydride, and forms the most stable acid salt. Lanthanum sulphate,
for example, requires to be heated for a considerable time at a white
heat if the pure oxide is required, whilst the sulphates of the less
positive elements are easily decomposed at a red heat. The order of
basic strength of the oxides, as determined by the ease with which
the sulphates are decomposed, seems, however, to be very different
from the order determined by decomposition of the nitrates (see p.
118).
With the alkali sulphates, the sulphates of the rare earth elements
readily form double salts, which are of great importance in
separation, on account of the great differences in solubility. The
double sulphates of the cerium group are almost insoluble in excess
of alkali sulphate, whereas the yttrium double sulphates, with the
exception of those of the terbium metals, which occupy an
intermediate position, are very easily soluble. This method of
separating the elements into the two main groups was first
employed by Berzelius, and though a century has elapsed, it remains
to-day the most efficient method of effecting the separation.
The ethylsulphates have been employed by Urbain and others in
effecting separations, especially in the erbium and terbium groups.
The solubilities of these salts are in the same general order as those
of the alkali double sulphates, and they are especially convenient for
separating the metals into the three groups of the cerium, terbium,
and yttrium elements respectively. They may be prepared by double
decomposition of the rare earth sulphates with barium ethylsulphate,
but on account of the ease with which the alkylsulphates are
hydrolysed by acids, it is essential that the solutions should be quite
neutral. A more convenient method, according to James, is the
treatment of the anhydrous chlorides in alcohol solution with sodium
ethylsulphate dissolved in the same medium; sodium chloride is
precipitated, whilst the ethylsulphates of the rare earth elements
remain in solution.
The sulphites of the rare earth elements are sparingly soluble
crystalline salts, of the general formula R₂(SO₃)₃,xH₂O. They are
obtained by passing sulphur dioxide into a suspension of the
hydroxides in water, or by double decomposition of soluble salts with
alkali sulphite. They dissolve in excess of sulphurous acid, and on
evaporation of the solution are deposited unchanged. They are
distinguished from thorium sulphite by the fact that they form no
alkali double salts. The strongly electropositive character of the rare
earth metals is shown by the fact that they form normal and not
basic sulphites.
The thiosulphates are readily soluble, crystalline bodies. With the
exception of the ceric and scandium salts, they are not hydrolysed in
boiling solution, a fact which allows of a complete separation from
the readily hydrolysed thiosulphates of zirconium and thorium.
Dithionates of the commoner rare earth elements, of the general
formula R₂(S₂O₆)₃,xH₂O, have been prepared by double
decomposition of the sulphates with barium dithionate. They are
readily soluble, crystalline salts.
The selenates are soluble, crystalline salts, which separate from
aqueous solutions in various hydrated forms. They resemble the
sulphates in being less soluble in hot than in cold water, and
numerous cases of isomorphism have been observed among the
corresponding sulphate and selenate hydrates. Several alkali double
selenates have been described; they show a close resemblance to
the analogous double sulphates.
The selenites are amorphous, insoluble compounds, obtained by
the action of selenious acid on the carbonates, or on solutions of
neutral salts. Basic and acid selenites are also known.

Nitrates. —The nitrates are crystalline, deliquescent compounds,


readily soluble in water and alcohol, but less easily in nitric acid, a
fact which has been of considerable importance for purposes of
separation. The solubility is greatest in the case of lanthanum
nitrate, diminishing through the cerium group to a minimum in
gadolinium nitrate, and then increasing again. They separate from
aqueous solution in the form of crystalline hydrates; in the cerium
group, these have commonly the formula R(NO₃)₃,6H₂O, whilst the
nitrates of the yttrium elements usually crystallise with 3 or 5
molecules of water. By carefully heating the hydrated salts, basic
nitrates may be obtained, which in the yttrium group are soluble in
water, and may be obtained crystalline; in the cerium group, the
basic nitrates are insoluble. By further heating, insoluble ‘superbasic
salts,’ and finally the oxides, are obtained in all cases. The
temperatures at which these basic and superbasic compounds are
formed vary with the electropositive character of the element; this
fact affords a method of separation which has been very frequently
employed.
An interesting series of addition compounds of the rare earth
nitrates with antipyrine (dimethylphenylpyrazolone, C₁₁H₁₂ON₂) has
been described recently by Kolbe.[164] Those of the cerium metals
have the general formula R(NO₃)₃,3C₁₁H₁₂ON₂; the yttrium nitrates
appear to combine with four molecules of the base.
[164] Zeitsch. anorg. Chem. 1913, 83, 143
The tendency to form double nitrates with nitrates of the metals of
Group Ia and Group IIa also varies with the basic strength of the
hydroxides. In the most positive elements of the cerium group, the
tendency is very pronounced, and there are a large number of
stable, crystalline double salts; but the stability decreases rapidly as
the atomic weight of the element rises, and in the terbium and
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like