From d15165b114f3db8ac9ae1aee9297474d93da8005 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Sun, 25 Oct 2020 21:16:26 -0400 Subject: [PATCH] move note --- docs/day1.md | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/day1.md b/docs/day1.md index a5a915c..a977d49 100644 --- a/docs/day1.md +++ b/docs/day1.md @@ -6,39 +6,39 @@ Before we can dive into our web project we have to cover some Python basics. Let 1. Make sure you have a (venv) to the left of your terminal cursor. Type `python` and press enter. - ![python_prompt](img/day1/python_prompt.gif) - -1. Type `1+1` and press enter. You should see `2` returned. As long as you see the `>>>` to the left of your cursor you can type any python code you want and press enter to execute it. - **NOTE**: This is not a terminal! You cannot run your django server from here. Before you can do things in the terminal you must exit by typing `exit()`! -1. Type `x=1` and press enter. Nothing should return. + ![python_prompt](img/day1/python_prompt.gif) -1. Type `x` and press enter. You should see `1` return. We've give `x` the value of `1` +2. Type `1+1` and press enter. You should see `2` returned. As long as you see the `>>>` to the left of your cursor you can type any python code you want and press enter to execute it. -1. Type `x+1` and press enter. You should see `2` returned just like `1+1` above. +3. Type `x=1` and press enter. Nothing should return. -1. Type `x=3` and press enter. Nothing should return. +4. Type `x` and press enter. You should see `1` return. We've give `x` the value of `1` -1. Type `x` and press enter. You should see `3` return. Variables in Python can be reassigned to anything else. +5. Type `x+1` and press enter. You should see `2` returned just like `1+1` above. -1. Type `x="hello"` and press enter. Nothing should return. +6. Type `x=3` and press enter. Nothing should return. -1. Type `x` and press etner. You should see `hello` printed to the screen. Variables in python do not have a "type" - they can be integers, strings, floats, etc and can switch between them at will. +7. Type `x` and press enter. You should see `3` return. Variables in Python can be reassigned to anything else. -1. Type `my_name = "\"` and press enter. Nothing should return +8. Type `x="hello"` and press enter. Nothing should return. -1. Type `my_name` and press enter. You should see your name printed to your terminal. `my_name` is a much better variable name than `x`. It describes the thing it stores. Please use variable names that are descriptive. +9. Type `x` and press etner. You should see `hello` printed to the screen. Variables in python do not have a "type" - they can be integers, strings, floats, etc and can switch between them at will. -1. Type `my_coordinates = (1,2)` and press enter. Nothing should return. +10. Type `my_name = "\"` and press enter. Nothing should return -1. Type `my_coordinates` and press enter. `(1,2)` should return. This is called a `tuple`. It's useful for storing multiple points of data. +11. Type `my_name` and press enter. You should see your name printed to your terminal. `my_name` is a much better variable name than `x`. It describes the thing it stores. Please use variable names that are descriptive. -1. Type `address = (123, "lane ave", "Columbus", "OH", 43212)` and press enter. Nothing should return +12. Type `my_coordinates = (1,2)` and press enter. Nothing should return. -1. Type `address` and press enter. You should see the address print to the terminal. Tuples can hold multiple types of data - 123 is a number and "lane ave" is a string. +13. Type `my_coordinates` and press enter. `(1,2)` should return. This is called a `tuple`. It's useful for storing multiple points of data. -1. Type `len(address)` and press enter. You should see `5` printed to the terminal. There are 5 "things" in the tuple: +14. Type `address = (123, "lane ave", "Columbus", "OH", 43212)` and press enter. Nothing should return + +15. Type `address` and press enter. You should see the address print to the terminal. Tuples can hold multiple types of data - 123 is a number and "lane ave" is a string. + +16. Type `len(address)` and press enter. You should see `5` printed to the terminal. There are 5 "things" in the tuple: `123 ` (1) @@ -50,17 +50,17 @@ Before we can dive into our web project we have to cover some Python basics. Let `43212` (5) -1. Type `address[0]` and press enter. You should see `123` printed to the terminal. You just accessed the first item in the tuple. Tuples and other collections start at 0 and count up. +17. Type `address[0]` and press enter. You should see `123` printed to the terminal. You just accessed the first item in the tuple. Tuples and other collections start at 0 and count up. -1. Type `address[1]` and press enter. You should see `"lane ave"` print to the terminal. You just accessed the second item in the tuple +18. Type `address[1]` and press enter. You should see `"lane ave"` print to the terminal. You just accessed the second item in the tuple -1. Type `vocabulary = {"apple": "the usually round, red or yellow, edible fruit of a small tree, Malus sylvestris, of the rose family.", "banana": "a tropical plant of the genus Musa, certain species of which are cultivated for their nutritious fruit."}` and press enter. Nothing should return. +19. Type `vocabulary = {"apple": "the usually round, red or yellow, edible fruit of a small tree, Malus sylvestris, of the rose family.", "banana": "a tropical plant of the genus Musa, certain species of which are cultivated for their nutritious fruit."}` and press enter. Nothing should return. -1. Type `vocabulary` and press enter. {"apple": ...} should print to the terminal. This is called a dictionary. +20. Type `vocabulary` and press enter. {"apple": ...} should print to the terminal. This is called a dictionary. -2. Type `vocabulary["apple"]` and press enter. `'the usually round, red or yellow, edible fruit of a small tree, Malus sylvestris, of the rose family.'` should print to the terminal. You just access the definition of apple. Much like tuples can be accessed with `address[0]` or `address[1]`, dictionary values can be accessed by supplying the keyword, or key for short. +21. Type `vocabulary["apple"]` and press enter. `'the usually round, red or yellow, edible fruit of a small tree, Malus sylvestris, of the rose family.'` should print to the terminal. You just access the definition of apple. Much like tuples can be accessed with `address[0]` or `address[1]`, dictionary values can be accessed by supplying the keyword, or key for short. -1. Type `exit()` and press enter. You should no longer see `>>>` to the left of the cursor. +22. Type `exit()` and press enter. You should no longer see `>>>` to the left of the cursor. ## A Python Program