Flow_0bngcu2
# Readability
The creator of Python, Guido van Rossum, said
“Code is read much more often than it’s written.” It is worth taking the time to create code that is easy to understand.
For this reason we recommend following a popular standard called [PEP8](https://realpython.com/python-pep8/)
Here are some highlights from the standard...
## Variables
### Formatting:
being consistent in the naming of your variables makes them far easier to remember. If you always use lower case and separate words with underscores, you don't have to try and remember the formatting, you just have to remember what it is called. If everyone follows this standard, then you can remember their variables easier as well ...
* my_name (GOOD)
* MyName (NO)
* myname (NO)
### Use Thoughtful names.
Avoid names that don't have meaning, or are cryptic. Try to use names that are descriptive and concise.
* first_name = "Abraham" (GOOD)
* x = "Abraham Lincoln" (AVOID)
* fn = "Abraham" (AVOID)
## Whitespace
* Use blank lines, sparingly, to show clear steps
A little white space can make your code more readable.
So can comments.
* "Sparse is better than dense" -- Zen of Python. Place spaces around operators and boolean operations most of the time. Though it can be good to break this rule when there are multiple expressions of different priority. Take the following example, where the second line is harder to read than the first.
```python
if x < 5: # GOOD
if x>5 and x<10 : # GOOD
if x > 5 and x < 10: # NOT AS GOOD
```
## Use Comments Sparingly
A few carefully chosen words can help *IF it isn't apparent already.* Good variable names and well written code come first. Then add additional comments only if the information is not already apparent in the code.
## Closing Brackets and braces
We work with dictionaries a lot. So we recommend closing your braces and brackets with the first line to make it easy to tell when the dictionary definition is complete. For example:
```python
children = {
"Robert",
"Edward"
"Tad",
"Willie"
}
```
# “Simple is better than complex.”
* Don't compare booleans, it's not necessary
```python
is_bigger = 6 > 5
if is_bigger: # GOOD
if is_bigger == True: # AVOID
```
* "is not" is easier to read:
```python
if not x is None: # AVOID
if x is not None: # GOOD
```
Flow_0ggy7w4
Flow_1s0vaon
Flow_0dwam7u
{}
{
"age": 54,
"height": 1.93,
"children": [
"Robert",
"Edward",
"Tad",
"Willie"
],
"is_married": true,
"my_age": 55,
"cabinet": {
"Secretary of State": {
"name": "William H. Seward",
"age": 60,
"children": [
"William Jr.",
"Frederick",
"Augustus",
"Anna"
]
}
}
}
Flow_0bngcu2
Flow_0ggy7w4
children
DataObjectReference_0wac5go
# Adding function
def add_one(input):
return input + 1
size = "medium"
# Creating Variables
age = 51 # This is an integer
height = 1.93 # This is a float or "floating point number"
children = ['Robert', 'Edward', 'Tad', 'Willie'] # This is a list
is_married = True # This is a boolean
# Updating Variables
Age = 50 # Variables are case sensitive, this is a new variable.
age = 54 # This updates the age variable.
# Referencing variables
my_age = age # my_age is now set to 54
my_age = add_one(my_age)
# Deleting variables
del(Age) # The age variable no longer exists. You will get an error if you try to use it.
# This is a dictionary, and you will use a lot of them...
cabinet = {
"Secretary of State": "William H. Seward",
"Secretary of the Treasury": "Salmon P. Chase",
"Secretary of War": "Edwin M. Stanton",
"Attorney General": "Edward Bates"
}
# Dictionaries can be deeply nested and contain any type of variable
cabinet = {
"Secretary of State": {
"name": "William H. Seward",
"age": 60,
"children": ['William Jr.', 'Frederick', 'Augustus', 'Anna']
}
}
Flow_1s0vaon
Flow_0x52gsc
Flow_0x52gsc
Flow_1hy1jl1
# Our dog picture

# List of Abe's Children:
{%- for child in children %}
* {{child}}
{% endfor -%}
# h1 Heading 8-)
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading
## Horizontal Rules
___
---
***
## Emphasis
**This is bold text**
__This is bold text__
*This is italic text*
_This is italic text_
~~Strikethrough~~
## Blockquotes
> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.
## Lists
Unordered
+ Create a list by starting a line with `+`, `-`, or `*`
+ Sub-lists are made by indenting 2 spaces:
- Marker character change forces new list start:
* Ac tristique libero volutpat at
+ Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
+ Very easy!
Ordered
1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa
1. You can use sequential numbers...
1. ...or keep all the numbers as `1.`
Start numbering with offset:
57. foo
1. bar
## Code
Inline `code`
Indented code
// Some comments
line 1 of code
line 2 of code
line 3 of code
Block code "fences"
```
Sample text here...
```
Syntax highlighting
``` js
var foo = function (bar) {
return bar++;
};
console.log(foo(5));
```
## Tables
| Option | Description |
| ------ | ----------- |
| data | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext | extension to be used for dest files. |
Right aligned columns
| Option | Description |
| ------:| -----------:|
| data | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext | extension to be used for dest files. |
## Links
[link text](http://dev.nodeca.com)
[link with title](http://nodeca.github.io/pica/demo/ "title text!")
Autoconverted link https://github.com/nodeca/pica (enable linkify to see)
## Images


Like links, Images also have a footnote style syntax
![Alt text][id]
With a reference later in the document defining the URL location:
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
### [Footnotes](https://github.com/markdown-it/markdown-it-footnote)
Footnote 1 link[^first].
Footnote 2 link[^second].
Inline footnote^[Text of inline footnote] definition.
Duplicated footnote reference[^second].
[^first]: Footnote **can have markup**
and multiple paragraphs.
[^second]: Footnote text.
### This is here
Because we wanted to show that footnotes end up at the very end of the page, not immediately below the footnote refernece.
Flow_1hy1jl1
Flow_19uhs80
children
Property_1biie0x
DataObjectReference_0wac5go
Property_1biie0x
decision_1
Flow_19uhs80
Flow_0dwam7u
The most straight forward way to create data is with a script task. Use the properties panel to the left, open the script section and launch the editor to see how we create variables.
Forms are another way to collect data. Note that we can reference "name" set in the first script task within the form to pre-populate fields.
You can also create data with a Service Task - here we reach out to a free API on the internet to get a random dog picture.
Manual tasks allow us to display data. In this example we display the image we collected in the previous step.
Decision Tables like this one allow us to reference the data we've collected to create new variables.
Data Stores are a special form of data that behaves differently than normal data. You can control which tasks can see it, which can write to it. It is never copied to the next task - only one copy ever exists, which causes it to behave differently in parallel tasks.