Skip to content

Commit

Permalink
cleanup work
Browse files Browse the repository at this point in the history
  • Loading branch information
krother committed Aug 24, 2023
1 parent 7417273 commit 75823db
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 198 deletions.
115 changes: 0 additions & 115 deletions appendix/goals.md

This file was deleted.

2 changes: 1 addition & 1 deletion challenges/count_words/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Coding Challenge: Count Words in Moby Dick
# Count Words

## In this challenge you can learn:

Expand Down
43 changes: 0 additions & 43 deletions data_structures/data_types.md

This file was deleted.

1 change: 0 additions & 1 deletion first_steps/for.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ area topic
🐞 recognize bugs at runtime
==== =============================

--------------

Exercise 1: Pat your own shoulder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion first_steps/hello.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ Exercise 6: Three little bugs

The following program should output a song by Bob Marley.
It contains three bugs.

Find and fix them.

.. code:: python3
Expand Down
1 change: 0 additions & 1 deletion first_steps/installing_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ both are not that easy to configure.

If you prefer to use the standard Python installation, you find it on
`www.python.org <https://www.python.org/downloads/>`__.

In that case, install spyder using the Python package manager ``pip``.
Type:

Expand Down
2 changes: 0 additions & 2 deletions first_steps/python_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Python as a Calculator
`photograph by Charles Deluvio on
Unsplash <https://unsplash.com/@charlesdeluvio>`__

--------------

In this chapter you will:
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -22,7 +21,6 @@ area topic
🔧 use the Variable Explorer
==== ================================
--------------

Arithmetics
-----------
Expand Down
5 changes: 2 additions & 3 deletions first_steps/rock_paper_scissors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ Rock-Paper-Scissors
`image by Enzoklop, CC BY-SA
3.0 <https://commons.wikimedia.org/w/index.php?curid=27958795>`__

--------------

In this chapter you will learn to:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this chapter you will:
~~~~~~~~~~~~~~~~~~~~~~~~~

======= ====================================
area topic
Expand Down
1 change: 0 additions & 1 deletion first_steps/slideshow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ area topic
🐞 fix wrong file paths
==== ===============================

--------------

Exercise 1: Display an image
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion first_steps/type_conversions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Ada Lovelace

Ada Lovelace

`Ada Lovelace, image by Alfred Edward Chalon - Biography.com, public
`Ada Lovelace, image by Alfred Edward Chalon - public
domain <https://commons.wikimedia.org/w/index.php?curid=25519820>`__


Expand Down
35 changes: 18 additions & 17 deletions index.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
Python Exercises for Beginners
==============================

.. topic:: Target Audience

Here you find exercises for people new to Python.
I wrote them for teachers looking for material
and people learning Python by themselves.

The goal of the exercises is to enable you to write
Python programs up to 200 lines.
The exercises cover six areas:

- 🚀 **applications** - programs that do fun stuff
- 💡 **functions and data types**
- ⚙ **syntax** - grammar rules, keywords and special
- **patterns** - useful expressions and idioms
- 🔧 **tools** that make programming easier
- 🐞 **debugging** techniques to discover and fix broken code
Here you find exercises for people new to Python.
I wrote them for teachers looking for material
and people learning Python by themselves.

The goal of the exercises is to enable you to write
Python programs up to 200 lines.
The exercises cover six areas:

=============================== ===================================
area description
=============================== ===================================
🚀 **applications** programs that do fun stuff
💡 **functions and data types** useful Python objects
⚙ **syntax** grammar rules and keywords
🔀 **patterns** useful expressions and idioms
🔧 **tools** things that make programming easier
🐞 **debugging** discover and fix broken code
=============================== ===================================


First Steps
Expand Down Expand Up @@ -46,7 +48,6 @@ Data Structures
data_structures/lists.md
data_structures/dictionaries.md
data_structures/tables.md
data_structures/data_types.md

--------------

Expand Down
51 changes: 42 additions & 9 deletions reference/data_types.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Data Types in Python
====================


Match the data samples with their types.

.. figure:: datatypes.png
:alt: datatype exercise

datatype exercise

========= ========================== ========= =======
data type description composite mutable
========= ========================== ========= =======
Expand All @@ -15,11 +23,20 @@ set collection of unique items yes yes
NoneType just nothing no no
========= ========================== ========= =======

Basic and composite data types
------------------------------
Composite data types
--------------------

**Basic** means that a data type does not contain any other types.
**Composite** means that a data type contains other types.
Some data types are **composite**, meaning that they may contain objects of other types.
For instance, a `list` can contains strings, numbers or even other lists.

Immutable and mutable data types
--------------------------------

In Python there are basic and composite data types. The values of basic
data types cannot be changed, they are **immutable**. Most of the
composite data types are **mutable**.

--------------

Immutable and mutable data types
--------------------------------
Expand All @@ -33,14 +50,30 @@ The immutable data types in Python are:
- Boolean (``True`` / ``False``)
- Integer (``0``, ``1``, ``-3``)
- Float (``1.0``, ``-0.3``, ``1.2345``)
- Strings (``'apple'``, ``"banana"``) - both single and double quotes
are valid
- Strings (``'apple'``, ``"banana"``) - both single and double quotes are valid
- None (aka an empty variable)
- Tuples (multiple values in parentheses,
e.g. \ ``('Jack', 'Smith', 1990)``)
- Tuples (multiple values in parentheses, e.g. \ ``('Jack', 'Smith', 1990)``)

The mutable data types are

- List [1, 2, 2, 3]
- Dictionary {‘name’: ‘John Smith’, ‘year’: 1990}
- Set ``{1, 2, 3}``
- Set ()

--------------

Type conversions
----------------

Values can be converted into each other using *conversion functions*.
Try the following:

::

int('5.5')
float(5)
str(5.5)
list("ABC")
tuple([1,2,3])
dict([('A',1),('B',2)])
set([1,2,2,3])
File renamed without changes
2 changes: 1 addition & 1 deletion tabular_data/os.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Working with directories
# Working with Directories

To process bigger amounts of data, you will need to work on more than one file. Sometimes you don't know all the files in advance.

Expand Down
2 changes: 1 addition & 1 deletion tabular_data/parsing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Parsing data from text
# Parsing Data from Text

Most text files contain both text and numbers. Extracting these data fields from a file and storing them in reasonably *structured* variables is called **parsing**. To parse files, we need methods of strings, lists and **type conversions**.

Expand Down
2 changes: 1 addition & 1 deletion tabular_data/readfile.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Reading text files
# Reading Text Files

In this chapter, you will learn to extract information from simple text files.

Expand Down

0 comments on commit 75823db

Please sign in to comment.