Skip to content

Commit 2edd099

Browse files
committed
And more formatting.
1 parent b8325af commit 2edd099

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

exercises/concept/guidos-gorgeous-lasagna/.docs/introduction.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,48 @@
22

33
Python is a [dynamic and strongly][dynamic typing in python] typed [object-oriented][object oriented programming] programming language.
44
It employs both [duck typing][duck typing] and [gradual typing][gradual typing], via [type hints][type hints].
5-
Python supports Imperative, declarative (e.g., functional), and object-oriented programming _styles_, but internally [everything in Python is an object][everythings an object].
5+
Imperative, declarative (e.g., functional), and object-oriented programming _styles_ are all supported, but internally [everything in Python is an object][everythings an object].
6+
7+
This exercise introduces 4 major Python language features: Name Assignment (_variables and constants_), Functions (_and the return keyword_), Comments, and Docstrings.
68

7-
This exercise introduces 4 major Python language features: Names (_variables and constants_), Functions (_and the return keyword_), Comments, and Docstrings.
89

910
~~~~exercism/note
1011
1112
In general, content, tests, and analyzer tooling for the Python track follow the style conventions outlined in [PEP 8](https://www.python.org/dev/peps/pep-0008/) and [PEP 257](https://www.python.org/dev/peps/pep-0257/) for Python code style, with the additional (strong) suggestion that there be no single letter variable names.
1213
1314
~~~~
1415

16+
1517
## Name Assignment and Re-assignment
1618

17-
There are no keywords in Python to define variables or constants and there is no difference in the way Python treats them.
18-
Both are considered [_names_][facts-and-myths-about-python-names] that help programmers reference values (_objects_) in a program and are written differently only by convention.
19+
In Python, there are no keywords to define variables or constants.
20+
Both are [_names_][facts-and-myths-about-python-names] that help programmers reference values (_objects_) in a program and are written differently only by convention.
1921
On Exercism, [variables][variables] are always written in [`snake_case`][snake case], and _constants_ in `SCREAMING_SNAKE_CASE`.
2022

21-
Names are assigned to values via `=`, or the [_assignment operator_][assignment statements]: `<name> = <value>`.
22-
A name (_variable or constant_) can be assigned or re-assigned over its lifetime to different values/different object types.
23-
For example, `my_first_variable` can be assigned and re-assigned many times using `=`, and can refer to different object types with each re-assignment:
23+
Names are assigned to values using `=`, or the [_assignment operator_][assignment statements] (`<name> = <value>`).
24+
A name (_variable or constant_) can be re-assigned over its lifetime to different values/object types.
25+
26+
For example, `my_first_variable` can be re-assigned many times using `=`, and can refer to different object types with each re-assignment:
2427

2528
```python
2629
# Assigning my_first_variable to a numeric value.
2730
>>> my_first_variable = 1
2831
>>> print(type(my_first_variable))
29-
...
3032
<class 'int'>
3133

3234
>>> print(my_first_variable)
33-
...
3435
1
3536

3637
# Reassigning my_first_variable to a new string value.
3738
>>> my_first_variable = "Now, I'm a string."
3839
>>> print(type(my_first_variable))
39-
...
4040
<class 'str'>
4141

4242
>>> print(my_first_variable)
43-
...
4443
"Now, I'm a string."
4544
```
4645

46+
4747
### Constants
4848

4949
Constants are typically defined at a [module][module] level, being values that are accessible outside function or class scope.
@@ -59,23 +59,26 @@ MY_FIRST_CONSTANT = 16
5959
# Please don't: MY_FIRST_CONSTANT = "Some other value"
6060
```
6161

62+
6263
## Functions
6364

6465
The keyword `def` begins a [function definition][function definition].
6566
It must be followed by the function name and a parenthesized list of zero or more formal [parameters][parameters].
6667
Parameters can be of several different varieties, and can even [vary][more on functions] in length.
67-
The `def` line is terminated with a colon.
68+
69+
The `def` line is terminated with a colon:
6870

6971
```python
70-
# function definition
72+
# Function definition.
7173
def my_function_name(parameter, second_parameter):
7274
<function body>
7375

7476
```
7577

7678

7779
Statements for the _body_ of the function begin on the line following `def` and must be _indented in a block_.
78-
There is no strict indentation amount (_either space **OR** [tab] characters are acceptable_), but [indentation][indentation] must be _consistent for all indented statements_.
80+
There is no strict indentation amount (_either space **OR** [tab] characters are acceptable_), but [indentation][indentation] must be _consistent_ for all indented statements.
81+
7982

8083
```python
8184
# Function definition on first line.
@@ -92,7 +95,7 @@ Functions explicitly return a value or object via the [`return`][return] keyword
9295
```python
9396
# Function definition on first line.
9497
def add_two_numbers(number_one, number_two):
95-
return number_one + number_two # Returns the sum of the numbers.
98+
return number_one + number_two # Returns the sum of the numbers.
9699

97100
>>> add_two_numbers(3, 4)
98101
7
@@ -185,6 +188,7 @@ Each line of a comment block must start with the `#` character.
185188

186189
Comments are ignored by the interpreter:
187190

191+
188192
```python
189193
# This is a single line comment.
190194

@@ -201,6 +205,7 @@ x = "foo" # This is an in-line comment.
201205
The first statement of a function body can optionally be a [_docstring_][docstring], which concisely summarizes the function or object's purpose.
202206
Docstrings are declared using triple double quotes (""") indented at the same level as the code block:
203207

208+
204209
```python
205210

206211
# An example from PEP257 of a multi-line docstring.

0 commit comments

Comments
 (0)