Skip to content
Permalink
Browse files
Moved macro stuff into seaprate repo and pulled in as submodule
  • Loading branch information
digehode committed Jul 13, 2020
1 parent 8410f4e commit b2273d9894cb700497457f8eea2caab1e9a85237
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 150 deletions.
@@ -12,9 +12,3 @@
float:right;
}


.state-TODO{
background: #AA0000;
color: #000;

}
@@ -1,9 +1,7 @@
# For Loops
Anytime you want to do anything more than once in a Python program, you should consider putting it inside a loop.
There are two types of loops in python, a 'for' loop and a 'while' loop. Generally 'for' loops are used when you know the amount of times you want to repeat something. It doesn't have to be an exact integer value, it can also be anything easily calculable. 'While' loops are used when you aren't sure how many times you need to repeat something, this could be to repeat something until a condition is reached or until a user tells it to stop.
In python, all control statements use indentation to define blocks of grouped code.

# For Loops (definite iteration)
{{ todo("Write intro specifically to for-loops") }}

## Iterating iterables
For loops always start with the keyword 'for' and then an iterator followed by some condition.
Here are a few examples:
@@ -57,4 +55,4 @@ When the loop finishes, anything in the 'else' statement is executed. If the loo
{{ code_from_file("for-loops/example-6.py", 22, 39) }}

## Test Your Knowledge: Countdown
See if you can create a loop that can count down from 10, and that once it gets to zero it prints the the word 'Liftoff!'. See if you can also make it print that the rocket was successfully launched.
See if you can create a loop that can count down from 10, and that once it gets to zero it prints the the word 'Liftoff!'. See if you can also make it print that the rocket was successfully launched.
@@ -1,24 +1,29 @@
# Introduction

1 to 6, download

{{ code_from_file("values-and-types/example-1.py", 1, 6, download=True) }}

Flavour is python, exec
{{ todo("Insert introduction, explaining the expectation, about the 'test your knowledge' tasks, etc.") }}

{{ code_from_file("values-and-types/example-1.py", flavor = "python", execute=True, download=True) }}

2 to 5
<!-- 1 to 6, download -->

{{ code_from_file("values-and-types/example-1.py", 2, 5) }}
<!-- {{ code_from_file("values-and-types/example-1.py", 1, 6, download=True) }} -->

to 5
<!-- Flavour is python, exec -->

{{ code_from_file("values-and-types/example-1.py", stop = 5) }}
<!-- {{ code_from_file("values-and-types/example-1.py", flavor = "python", execute=True, download=True) }} -->

2 to 5, bash
<!-- 2 to 5 -->

{{ code_from_file("values-and-types/example-1.py", 2, 5, "bash") }}
<!-- {{ code_from_file("values-and-types/example-1.py", 2, 5) }} -->

<!-- to 5 -->

<!-- {{ code_from_file("values-and-types/example-1.py", stop = 5) }} -->

<!-- 2 to 5, bash -->

<!-- {{ code_from_file("values-and-types/example-1.py", 2, 5, "bash") }} -->


# Contents
@@ -0,0 +1,18 @@
# Iteration

{{ todo("Actually write this") }}


Anytime you want to do anything more than once in a Python program, you should consider putting it inside a loop.
There are two types of loops in python, a 'for' loop and a 'while' loop. Generally 'for' loops are used when you know the amount of times you want to repeat something. It doesn't have to be an exact integer value, it can also be anything easily calculable. 'While' loops are used when you aren't sure how many times you need to repeat something, this could be to repeat something until a condition is reached or until a user tells it to stop.

- [For loops](./for-loops/README.md)
- [While loops](./while-loops/README.md)


Also, recursion

- [Recursion](./recursion/README.md)



@@ -1,4 +1,8 @@
# Values and Types

{{ todo("Explain what types are first, then move on to how many and such.") }}


There are 4 basic types in python; Boolean, integer, floating point number and string. Booleans or "bools" are either true or false, a one or a zero, they are representative of the binary calculations that make computers work. Integers are any whole number and can be both positive and negative numbers, where as floating point numbers are anything with a decimal point in. A string is an interesting type as it also works like an iterable which we'll see more of later, but it stores a string of characters together. Every time we make a value that a computer needs to be able to reuse, we call that type a "variable". Let's look at some examples of how we use types and make variables:

## Basic Types: Creating your first variable
@@ -1,10 +1,11 @@
# Iteration or Loops
# While Loops (indefinite iteration)


Anytime you want to do anything more than once in a Python program, you should consider putting it inside a loop.
There are two types of loops in python, a 'for' loop and a 'while' loop. Generally 'for' loops are used when you know the amount of times you want to repeat something. It doesn't have to be an exact integer value, it can also be anything easily calculable. 'While' loops are used when you aren't sure how many times you need to repeat something or you need to do something recursively.
In python, all control statements use indentation to define blocks of grouped code.

# While Loops (indefinite iteration)

In 'while' loops, there is a definite shape to the way every one of them is written. Every 'while' loop is this kind of shape:
```python
while <condition>:
@@ -27,4 +28,4 @@ Here are a few 'while' loops to give you some ideas of the kinds of ways you mig
{{ code_from_file("while-loops/example-3.py") }}

## Test your knowledge
Create a while loop that calculates the Fibonacci sequence
Create a while loop that calculates the Fibonacci sequence
119 main.py

This file was deleted.

Submodule mk_doc_ultra updated 1 files
+127 −0 main.py
@@ -5,6 +5,7 @@ nav:
- 'Values and Types': 'values-and-types/README.md'
- 'Conditionals': 'conditionals/README.md'
- 'Iteration':
- 'Introduction to iteration': 'iteration.md'
- 'For Loops': 'for-loops/README.md'
- 'While Loops': 'while-loops/README.md'
- 'Recursion': 'recursion/README.md'
@@ -17,6 +18,7 @@ plugins:
- search
- macros


theme:
name: material
logo: 'images/logo.svg'
@@ -25,15 +27,13 @@ theme:
accent: 'indigo'


module_name: main

extra:
price: 12.50
company:
name: Acme
website: www.acme.com
draft: 1
year: '2020/21'



extra_css:
- css/extra.css
- css/mk_ultra.css

0 comments on commit b2273d9

Please sign in to comment.