Skip to content

Commit

Permalink
got rid of all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristian Rother committed Jan 3, 2024
1 parent 04797f2 commit fe1745e
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 316 deletions.
18 changes: 9 additions & 9 deletions challenges/count_words.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ have mastered this challenge.
The Data
--------

You can find the full text for Herman Melvilles “Moby Dick” in the text
file :download:`mobydick.txt` and on
You can find the full text for Herman Melville's “Moby Dick” in the text
file :download:`moby_dick.txt` and on
`www.gutenberg.org <http://www.gutenberg.org>`__.

Hints
Expand Down Expand Up @@ -91,8 +91,8 @@ Which operations on this data type will be necessary to
.. code:: python3
counter = {}
counter.setdefault(fish, 0)
counter[fish] += 1
counter.setdefault('fish', 0)
counter['fish'] += 1
Hint 4: Functions
Expand Down Expand Up @@ -157,16 +157,16 @@ How does Python sort integers, strings, tuples, and other lists?
Hint 7: Did it work?
~~~~~~~~~~~~~~~~~~~~
Where would you expect words like ‘is’, ‘the’, ‘sea, and cerebellum to occur?
Where would you expect words like 'is', 'the', 'sea', and 'cerebellum' to occur?
Check whether the output of the program corresponds to your expectations.
Does captain or whale occur more often in the text?
Does 'captain' or 'whale' occur more often in the text?

.. hint::

The first five places should be taken by of (6614), and (6433), a (4726), to (4625), and in (4173).
You have to check yourself whether whale or captain is first.
You have to check yourself whether 'whale' or 'captain' is first.


Hint 8: Special characters
~~~~~~~~~~~~~~~~~~~~~~~~~~
Special and uppercase characters may be a problem when separating words.
Expand Down
7 changes: 1 addition & 6 deletions challenges/postcard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ Create a Postcard

**🎯 Write a program that composes a postcard from your favorite city.**

.. figure:: images/poznan.png
:alt: Welcome to Poznan

Welcome to Poznan

Step 1: Images
--------------

Expand Down Expand Up @@ -82,7 +77,7 @@ Paste images with Pillow:
.. code:: python3
image1.paste(image2, (0, 0))
image1.save(postcard.png)
image1.save('postcard.png')
- Create a postcard composed of smaller pictures
- Add the horizontal bar and some text on it.
Expand Down
8 changes: 4 additions & 4 deletions data_structures/dictionaries.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

# Dictionaries

### Exercise 1: Explore
## Exercise 1: Explore

Find out what each of the expressions does to the dictionary in the center.

![dict exercise](dicts.png)

----

### Exercise 2: Commands
## Exercise 2: Commands

Define a dictionary:

Expand All @@ -34,7 +34,7 @@ Then run the following commands and find out what they result in:

----

### Exercise 3
## Exercise 3

The following program allows you to travel from one city to the next.
Unfortunately, it contains **three bugs**. Find and fix them.
Expand Down Expand Up @@ -62,7 +62,7 @@ Unfortunately, it contains **three bugs**. Find and fix them.

----

### Reflection Questions
## Reflection Questions

* How can you create a dictionary?
* How can you modify values in a dictionary?
Expand Down
8 changes: 4 additions & 4 deletions data_structures/tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In this chapter we will create and process nested lists.

----

### Exercise 1
## Exercise 1

Write all rows of the above table to the screen with a `for` loop.

Expand All @@ -35,13 +35,13 @@ Complete the code:

----

### Exercise 2
## Exercise 2

Now modify the loop to output only the names.

----

### Exercise 3
## Exercise 3

Write all *cells* of the table to the screen with a nested `for` loop.

Expand All @@ -53,7 +53,7 @@ Complete the code:

----

### Exercise 4
## Exercise 4

Create an empty table of 10 x 10 cells and fill them with numbers from 1 to 100.

Expand Down
2 changes: 1 addition & 1 deletion first_steps/guess_the_number.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ In the **Guess the Number** game, the player tries to guess a number that the co
5. Repeat steps 3-5 until the correct number was guessed.

Example output:
---------------
~~~~~~~~~~~~~~~

::

Expand Down
15 changes: 7 additions & 8 deletions first_steps/python_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Unsplash <https://unsplash.com/@charlesdeluvio>`__


In this chapter you will:
~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------

==== ================================
area topic
==== ================================
🚀 use Python as a pocket calculator
💡 use the data type *integer*
⚙ use arithmetical operators (+-*/)
⚙ use arithmetical operators (+-\*/)
⚙ store numbers in a variable
⚙ change the contents of a variable
🔧 use the Variable Explorer
Expand Down Expand Up @@ -170,12 +170,11 @@ The rabbits constantly multiply. Every month, their number grows by

**How many rabbits will you have in December?**

Hints:
^^^^^^

- assume that rabbits never die
- it is ok to calculate with fractions of rabbits
- it is ok to copy the same lines multiple times for each month
.. hint::

- assume that rabbits never die
- it is ok to calculate with fractions of rabbits
- it is ok to copy the same lines multiple times for each month

.. |image0| image:: calculator.png

Expand Down
64 changes: 0 additions & 64 deletions reference/README.rst

This file was deleted.

9 changes: 3 additions & 6 deletions reference/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ Overview

The table lists some frequently used functions in ``os``:

================================
=================================================
================================ =================================================
function description
================================
=================================================
================================ =================================================
``os.listdir(path)`` returns list of file names in ``path``
``os.remove(path)`` removes a file
``os.getcwd()`` returns current working directory
Expand All @@ -82,5 +80,4 @@ function description
``os.path.join(d1, d2, d3, ..)`` connects names by path separator
``os.environ[key]`` dictionary of environment variables
``os.system(cmd)`` executes shell command
================================
=================================================
================================ =================================================
12 changes: 6 additions & 6 deletions structure/builtin_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Python 3.11 has 75 builtin functions.
To start writing useful programs, knowing about 25 of them is sufficient.
Here you find a few exercises where you use builtin functions to make code shorter.

### Exercise 1
## Exercise 1

Simplify the following code using the function `sum()`:

Expand All @@ -16,7 +16,7 @@ Simplify the following code using the function `sum()`:
total = total + number
print(total)

### Exercise 2
## Exercise 2

Simplify the following code using the function `range()`:

Expand All @@ -25,7 +25,7 @@ Simplify the following code using the function `range()`:
print(i * '*')
i += 1

### Exercise 3
## Exercise 3

Simplify the following code using the function `zip()`:

Expand All @@ -40,7 +40,7 @@ Simplify the following code using the function `zip()`:
i += 1
print(table)

### Exercise 4
## Exercise 4

Simplify the following code using the function `enumerate()`:

Expand All @@ -51,7 +51,7 @@ Simplify the following code using the function `enumerate()`:
print(i, name)
i += 1

### Exercise 5
## Exercise 5

Use `list(range())` to create the following lists:

Expand All @@ -62,7 +62,7 @@ Use `list(range())` to create the following lists:
[33, 32, 31, 30]


### Exercise 6
## Exercise 6

On which data types does the `len()` function work?

Expand Down
14 changes: 7 additions & 7 deletions structure/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Writing all instructions into a single sequence creates programs that are hard to debug.
Here, you learn to break the code down into smaller units: **functions**.

### In this chapter you learn:
## In this chapter you learn:

| Bereich | Thema |
|---------|-------|
Expand All @@ -18,7 +18,7 @@ Here, you learn to break the code down into smaller units: **functions**.

----

### Exercise 1: Sum up
## Exercise 1: Sum up

Write a function that calculates a sum from a list of numers.
Insert into the gaps: `amount`, `data`, `def`, `return`, `calc_sum', `+=`
Expand All @@ -35,7 +35,7 @@ Insert into the gaps: `amount`, `data`, `def`, `return`, `calc_sum', `+=`

----

### Exercise 2: Mean
## Exercise 2: Mean

Write a function that calculates the arithmetic mean from the following numbers:

Expand All @@ -50,7 +50,7 @@ Find out what the function should deliver with `return`.

----

### Exercise 3: Standard Deviation
## Exercise 3: Standard Deviation

The following program calculates the standard deviation from a list of numbers.
You would like to generalize the code, so that it can be used with other data sets.
Expand All @@ -72,7 +72,7 @@ Wrap the code for the calculation – but not the data – in a function.

----

### Exercise 4: Optional Parameters
## Exercise 4: Optional Parameters

Explain the program:

Expand All @@ -89,7 +89,7 @@ Explain the program:

----

### Exercise 5: Recursion
## Exercise 5: Recursion

Explain the code:

Expand All @@ -107,7 +107,7 @@ Explain the code:

----

### Reflection Questions
## Reflection Questions

* Why is it useful to write functions?
* What is the difference between a function and a method?
Expand Down
Loading

0 comments on commit fe1745e

Please sign in to comment.