Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions brisk_python.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ a + b
a * b
```

By default, jupyter notebook cells will only print the results of the last line of code when it is not assigned to a variable. To print the results of previous lines of codes in the cell as well, the function print() can be used:

```{python}
print(a + b)
a * b
```

Dividing an int by an int also gives a float:

```{python}
Expand Down Expand Up @@ -107,7 +114,6 @@ The `%` operator on numbers gives you the remainder of integer division
5.0 % 2.0
```

(true-and-false)=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed? (please re-add)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In binder they look like this. I was not sure if they were a mistake.

image

But now I see on the website version they look OK.

image

Should I re-add still? Should I look for a way the they do not look like that in Binder? I now assume they are there for a reason, do you know what is the function of those lines?


## True and False

Expand Down Expand Up @@ -186,7 +192,6 @@ different from MATLAB, which uses `~=`:
a != 1
```

(comparison-operators)=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto


## Comparison operators

Expand Down Expand Up @@ -269,7 +274,7 @@ print('not True:', not True)
print('not False:', not False)
```

In fact, the logical operators will first force their arguments to be True or False before they give their answer. So, in the case of `and` or `or`, they force force their left and right arguents to be `bool` values, before they calculate the answer. So, in fact, you can use things other than exact True and False on either side of the `and` or `or`, as long as applying `bool(value)` to the thing to the left and right will produce a True or False value. See {doc}`truthiness` for more detail.
In fact, the logical operators will first force their arguments to be True or False before they give their answer. So, in the case of `and` or `or`, they force their left and right arguents to be `bool` values, before they calculate the answer. So, in fact, you can use things other than exact True and False on either side of the `and` or `or`, as long as applying `bool(value)` to the thing to the left and right will produce a True or False value. See {doc}`truthiness` for more detail.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In fact, the logical operators will first force their arguments to be True or False before they give their answer. So, in the case of `and` or `or`, they force their left and right arguents to be `bool` values, before they calculate the answer. So, in fact, you can use things other than exact True and False on either side of the `and` or `or`, as long as applying `bool(value)` to the thing to the left and right will produce a True or False value. See {doc}`truthiness` for more detail.
In fact, the logical operators will first force their arguments to be True or False before they give their answer. So, in the case of `and` or `or`, they force their left and right arguents to be `bool` values, before they calculate the answer. So, in fact, you can use things other than exact `True` and `False` on either side of the `and` or `or`, as long as applying `bool(value)` to the thing to the left and right will produce a True or False value. See {doc}`truthiness` for more detail.


## “If” statements, blocks and indention

Expand Down Expand Up @@ -689,7 +694,6 @@ you a reversed copy of the list:
my_list[::-1]
```

(tuples)=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto


## Tuples

Expand Down Expand Up @@ -869,7 +873,7 @@ characters removed from the beginning and end of the string:
```{python}
# A string with a newline character at the end
my_string = ' a string\n'
my_string
print(my_string)
my_string.strip()
```

Expand Down Expand Up @@ -1064,7 +1068,7 @@ software = {}
```

Here we insert a new key / value mapping into the dictionary. The key is a
string — `'Python'` — and the corresponding value is an integer 50:
string — `'Python'` — and the corresponding value is an integer 100:

```{python}
software['Python'] = 100
Expand Down
1 change: 1 addition & 0 deletions choosing_editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ to PyCharm users).
* [Sublime text](https://www.sublimetext.com)
* [Emacs](https://emacs.org)
* [Spyder](https://www.spyder-ide.org)
* [GitHub Codespaces](https://github.com/features/codespaces)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* [GitHub Codespaces](https://github.com/features/codespaces)


## Some version of Visual Studio Code

Expand Down
2 changes: 1 addition & 1 deletion the_software.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ post](http://asterisk.dynevor.org/python-matlab.html).

## The Jupyter Notebook

We will soon here more about the Jupyter Notebook. It is a particularly
We will soon hear more about the Jupyter Notebook. It is a particularly
easy interface to run Python code, and display the results.

The Notebook has two parts. The first is the web application, that you
Expand Down