Skip to content

Commit

Permalink
01-numpy.md: fix typos, reword, improve
Browse files Browse the repository at this point in the history
See discussion here:
swcarpentry#538
  • Loading branch information
maxim-belkin committed May 24, 2018
1 parent 5c7851d commit 90ca550
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions _episodes/01-numpy.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,22 @@ it. In essence, **a variable is just a name for a value**.

In Python, variable names:

- must begin with a letter, and
- variable names can include upper and lowercase letters, digits, and underscores, but cannot
start with a digit
- are [case sensitive]({{ page.root }}/reference/#case-sensitive).

This means that, for example:
- `weight0` is a valid variable name, whereas `0weight` is not
- `weight` and `Weight` are different variables

## Types of data
Python knows various types of data. The most common ones are:
Python knows various types of data. Three common ones are:

* integer numbers
* floating point numbers, and
* strings.

In the example above, variabe `weight_kg` has an integer value of `60`.
In the example above, variable `weight_kg` has an integer value of `60`.
To create a variable with a floating point value, we can execute:

~~~
Expand All @@ -90,7 +91,7 @@ weight_kg_text = 'weight in kilograms:'
{: .language-python}

## Using Variables in Python
To display the value of a variable to the screen in Python, we can use `print` function:
To display the value of a variable to the screen in Python, we can use the `print` function:

~~~
print(weight_kg)
Expand Down Expand Up @@ -136,7 +137,7 @@ print(weight_kg)
~~~
{: .output}

To change variable's value, we have to assign it a new one:
To change value of the `weight_kg` variable, we have to assign it a new one:

~~~
weight_kg = 65.0
Expand All @@ -149,8 +150,8 @@ weight in kilograms is now: 65.0
~~~
{: .output}

A variable is analoguous to a sticky note with a name written on it:
assigning value to a variable is like putting that sticky note on a particular value.
A variable is analogous to a sticky note with a name written on it:
assigning a value to a variable is like putting that sticky note on a particular value.

![Variables as Sticky Notes](../fig/python-sticky-note-variables-01.svg)

Expand Down

0 comments on commit 90ca550

Please sign in to comment.