kristofer revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 1 deletion
TastyHint1.md
| @@ -46,7 +46,7 @@ else: | |||
| 46 | 46 | ||
| 47 | 47 | # to list all the tasks | |
| 48 | 48 | ||
| 49 | - | for task_name, status in enumerate(tasks.items()): | |
| 49 | + | for task_name, status in tasks.items(): | |
| 50 | 50 | print("- ", task_name, status) | |
| 51 | 51 | ``` | |
| 52 | 52 | ||
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 4 insertions, 1 deletion
TastyHint1.md
| @@ -37,9 +37,12 @@ tasks['Finish Lab'] = 'not yet' | |||
| 37 | 37 | task_name = 'Buy Milk' | |
| 38 | 38 | ||
| 39 | 39 | if tasks[task_name] == 'not yet': | |
| 40 | - | # task is unfinished | |
| 40 | + | # task is unfinished | |
| 41 | + | pass | |
| 41 | 42 | else: | |
| 42 | 43 | # task is 'complete' | |
| 44 | + | pass | |
| 45 | + | ||
| 43 | 46 | ||
| 44 | 47 | # to list all the tasks | |
| 45 | 48 | ||
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 3 insertions
TastyHint1.md
| @@ -28,6 +28,9 @@ Imagine a dict like this one: | |||
| 28 | 28 | tasks = {} # creates an empty dictionary | |
| 29 | 29 | ||
| 30 | 30 | tasks['Buy Milk'] = 'not yet' | |
| 31 | + | tasks['Start Lab'] = 'completed' | |
| 32 | + | ||
| 33 | + | tasks['Finish Lab'] = 'not yet' | |
| 31 | 34 | ||
| 32 | 35 | # to test if something is done? | |
| 33 | 36 | ||
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 18 deletions
TastyHint1.md
| @@ -42,22 +42,5 @@ else: | |||
| 42 | 42 | ||
| 43 | 43 | for task_name, status in enumerate(tasks.items()): | |
| 44 | 44 | print("- ", task_name, status) | |
| 45 | - | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - | ||
| 50 | - | ||
| 51 | - | ||
| 52 | - | ||
| 53 | - | ||
| 54 | - | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - | ||
| 45 | + | ``` | |
| 63 | 46 | ||
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 5 insertions, 2 deletions
TastyHint1.md
| @@ -2,14 +2,17 @@ Remember start _very small_ and build outward. | |||
| 2 | 2 | ||
| 3 | 3 | ## Hint 1 | |
| 4 | 4 | ||
| 5 | - | If you haven't already decided what | |
| 5 | + | If you haven't already decided how to start... | |
| 6 | + | ||
| 7 | + | This is the `tasks` variable. | |
| 6 | 8 | ||
| 7 | 9 | ``` | |
| 8 | 10 | Tasty class. | |
| 9 | 11 | :param tasks: the user tasks | |
| 10 | 12 | ``` | |
| 11 | 13 | ||
| 12 | - | this is the `tasks` variable. It tracks all the tasks that get added and removed. | |
| 14 | + | The most important thing is the tasks you're tracking. | |
| 15 | + | It tracks all the tasks, things that get added and removed. | |
| 13 | 16 | ||
| 14 | 17 | What are the two things you want to track? | |
| 15 | 18 | ||
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 60 insertions
TastyHint1.md(vytvořil soubor)
| @@ -0,0 +1,60 @@ | |||
| 1 | + | Remember start _very small_ and build outward. | |
| 2 | + | ||
| 3 | + | ## Hint 1 | |
| 4 | + | ||
| 5 | + | If you haven't already decided what | |
| 6 | + | ||
| 7 | + | ``` | |
| 8 | + | Tasty class. | |
| 9 | + | :param tasks: the user tasks | |
| 10 | + | ``` | |
| 11 | + | ||
| 12 | + | this is the `tasks` variable. It tracks all the tasks that get added and removed. | |
| 13 | + | ||
| 14 | + | What are the two things you want to track? | |
| 15 | + | ||
| 16 | + | - the name/title of the Task _Buy Milk_ | |
| 17 | + | - status of Task _complete_ or _not yet_ | |
| 18 | + | ||
| 19 | + | so in Python, if you have a pair things that need to be tracked together, a good possibility is a Dictionary. | |
| 20 | + | ||
| 21 | + | Imagine a dict like this one: | |
| 22 | + | ||
| 23 | + | ```python | |
| 24 | + | ||
| 25 | + | tasks = {} # creates an empty dictionary | |
| 26 | + | ||
| 27 | + | tasks['Buy Milk'] = 'not yet' | |
| 28 | + | ||
| 29 | + | # to test if something is done? | |
| 30 | + | ||
| 31 | + | task_name = 'Buy Milk' | |
| 32 | + | ||
| 33 | + | if tasks[task_name] == 'not yet': | |
| 34 | + | # task is unfinished | |
| 35 | + | else: | |
| 36 | + | # task is 'complete' | |
| 37 | + | ||
| 38 | + | # to list all the tasks | |
| 39 | + | ||
| 40 | + | for task_name, status in enumerate(tasks.items()): | |
| 41 | + | print("- ", task_name, status) | |
| 42 | + | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + | ||