-
Notifications
You must be signed in to change notification settings - Fork 14
Printing all results in a cell | Removed possible unintended texts | Corrected typos | Report broken hyperlinks in binder (see below) #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
02b46b0
0bfff10
5679370
90de442
7de1712
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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} | ||||||
|
@@ -107,7 +114,6 @@ The `%` operator on numbers gives you the remainder of integer division | |||||
5.0 % 2.0 | ||||||
``` | ||||||
|
||||||
(true-and-false)= | ||||||
|
||||||
## True and False | ||||||
|
||||||
|
@@ -186,7 +192,6 @@ different from MATLAB, which uses `~=`: | |||||
a != 1 | ||||||
``` | ||||||
|
||||||
(comparison-operators)= | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||||||
|
||||||
## Comparison operators | ||||||
|
||||||
|
@@ -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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
## “If” statements, blocks and indention | ||||||
|
||||||
|
@@ -689,7 +694,6 @@ you a reversed copy of the list: | |||||
my_list[::-1] | ||||||
``` | ||||||
|
||||||
(tuples)= | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||||||
|
||||||
## Tuples | ||||||
|
||||||
|
@@ -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() | ||||||
``` | ||||||
|
||||||
|
@@ -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 | ||||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -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) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
|
||||
## Some version of Visual Studio Code | ||||
|
||||
|
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
But now I see on the website version they look OK.
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?