From ba0f60304977ba6d27982b84d9cd38869aadc884 Mon Sep 17 00:00:00 2001 From: Dan McCreary Date: Sat, 30 Oct 2021 14:17:59 -0500 Subject: [PATCH 01/28] updates to markdown content --- .vscode/settings.json | 1 + .../20-installing-local-python.md | 7 +++ docs/trinket/08c-turtle-shapes.md | 43 +++++++++++++++++++ mkdocs.yml | 1 + src/intermediate/sine-plot.py | 23 ++++++++++ src/ops/01-intro.md | 0 src/ops/README.md | 9 ++++ src/ops/ping-all-os.py | 18 ++++++++ src/ops/ping.py | 11 +++++ 9 files changed, 113 insertions(+) create mode 100644 docs/trinket/08c-turtle-shapes.md create mode 100644 src/intermediate/sine-plot.py create mode 100644 src/ops/01-intro.md create mode 100644 src/ops/README.md create mode 100644 src/ops/ping-all-os.py create mode 100644 src/ops/ping.py diff --git a/.vscode/settings.json b/.vscode/settings.json index e9540ffb..9a49861c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "cSpell.words": [ + "Mojhave", "Trinkit", "coderdojo", "jupyter", diff --git a/docs/intermediate/20-installing-local-python.md b/docs/intermediate/20-installing-local-python.md index a85672cf..13ba2762 100644 --- a/docs/intermediate/20-installing-local-python.md +++ b/docs/intermediate/20-installing-local-python.md @@ -44,6 +44,13 @@ for step in range(0, len(myPath)): print(step+1, myPath[step]) ``` +## Using Conda Environments +We use conda to keep all our Python projects separate. + +```sh +conda create -n coderdojo python=3 +conda activate coderdojo +``` ## Installing Python in an Integrated Development Environment (IDE) diff --git a/docs/trinket/08c-turtle-shapes.md b/docs/trinket/08c-turtle-shapes.md new file mode 100644 index 00000000..87591c1e --- /dev/null +++ b/docs/trinket/08c-turtle-shapes.md @@ -0,0 +1,43 @@ +# Change the Turtle Shape + +You can change your turtle shape to be any of the following: + +1. 'arrow' +2. 'turtle' +3. 'circle' +4. 'square' +5. 'triangle' +6. 'classic' + +```py +import turtle +dan = turtle.Turtle() +dan.shape('square') +``` + +The ```classic``` shape is a small arrow. + +## Using a List of Shapes +What if we want to use a list of shapes? + +```py +import turtle, time +dan = turtle.Turtle() + +myList = ["square", "circle", 'triangle', 'arrow', 'classic', 'turtle'] + +for index in range(0, len(myList)): + dan.shape(myList[index]) + time.sleep(1) +``` + +```py +import turtle, time +dan = turtle.Turtle() + +myList = ["square", "circle", 'triangle', 'arrow', 'classic', 'turtle'] + +for myShape in myList: + dan.shape(myShape) + time.sleep(1) +``` diff --git a/mkdocs.yml b/mkdocs.yml index 65741107..670f84aa 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -14,6 +14,7 @@ nav: - Flower: trinket/07-flower.md - Function Parameters: trinket/07-function-parameters.md - Lists: trinket/08-list.md + - Turtle Shape Lists: trinket/09-turtle-shapes.md - Random Numbers: trinket/08-random.md - Random Stars: trinket/13-random-stars.md - Input: trinket/11-input.md diff --git a/src/intermediate/sine-plot.py b/src/intermediate/sine-plot.py new file mode 100644 index 00000000..3401c06c --- /dev/null +++ b/src/intermediate/sine-plot.py @@ -0,0 +1,23 @@ +import numpy as np +import matplotlib.pyplot as plot +# Get x values of the sine wave +time = np.arange(0, 10, 0.1); + +# Amplitude of the sine wave is sine of a variable like time +amplitude = np.cos(time) + +# Plot a sine wave using time and amplitude obtained for the sine wave +plot.plot(time, amplitude) + +# Give a title for the sine wave plot +plot.title('Sine wave') + +# Give x axis label for the sine wave plot +plot.xlabel('Time') + +# Give y axis label for the sine wave plot + +plot.ylabel('Amplitude = sin(time)') +plot.grid(True, which='both') +plot.axhline(y=0, color='k') +plot.show() diff --git a/src/ops/01-intro.md b/src/ops/01-intro.md new file mode 100644 index 00000000..e69de29b diff --git a/src/ops/README.md b/src/ops/README.md new file mode 100644 index 00000000..9e9ed90a --- /dev/null +++ b/src/ops/README.md @@ -0,0 +1,9 @@ +# Using Python Do Operations Management + +This directory is for teaching how to use Python to do Operations Management. This includes things like: + +1. Montoring the network +2. Getting notified if a remote computer is not working +3. Creating deploymnet scripts that install software on a remote system +4. Creating graphs that display response times to remote sites +5. Building notification systems that tell people when performance drops below a specfic value diff --git a/src/ops/ping-all-os.py b/src/ops/ping-all-os.py new file mode 100644 index 00000000..f06f6632 --- /dev/null +++ b/src/ops/ping-all-os.py @@ -0,0 +1,18 @@ +import platform # For getting the operating system name +import subprocess # For executing a shell command + +def ping(host): + """ + Returns True if host (str) responds to a ping request. + Remember that a host may not respond to a ping (ICMP) request even if the host name is valid. + """ + + # Option for the number of packets as a function of + param = '-n' if platform.system().lower()=='windows' else '-c' + + # Building the command. Ex: "ping -c 1 google.com" + command = ['ping', param, '1', host] + + return subprocess.call(command) == 0 + +ping(127.0.0.1) diff --git a/src/ops/ping.py b/src/ops/ping.py new file mode 100644 index 00000000..4c0fad81 --- /dev/null +++ b/src/ops/ping.py @@ -0,0 +1,11 @@ +import os +# sample code taken from: https://stackoverflow.com/questions/2953462/pinging-servers-in-python +# This will the Unix "ping" command which will work from most Mac and UNIX systems but not on Windows +hostname = "127.0.0.1" # example of pinging the loopback address +response = os.system("ping -c 1 " + hostname) + +#and then check the response... +if response == 0: + print(hostname, 'is up!') +else: + print(hostname, 'is down!') From 5700796d7763fc1bfb60e53f281f2ba9c31da542 Mon Sep 17 00:00:00 2001 From: Dan McCreary Date: Sat, 30 Oct 2021 14:50:50 -0500 Subject: [PATCH 02/28] updates to markdown content --- docs/trinket/08-list.md | 26 ++++++++++++++++++++++++++ docs/trinket/08c-turtle-shapes.md | 16 ++++++++-------- mkdocs.yml | 2 +- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/docs/trinket/08-list.md b/docs/trinket/08-list.md index 8458978e..7db8653e 100644 --- a/docs/trinket/08-list.md +++ b/docs/trinket/08-list.md @@ -29,6 +29,32 @@ dan.circle(20) dan.end_fill() ``` +## Iterating over many colors + +```py +import turtle +import random +dan = turtle.Turtle() +dan.shape('turtle') + +color_list = ['red', 'orange', 'yellow', 'green', 'blue', + 'purple', 'pink', 'brown', 'gray', 'gold', 'cyan', 'Gainsboro', 'gray', + 'dimgray', 'LightSlateGray','AliceBlue', 'LimeGreen', 'DarkKhaki', 'Khaki'] + +dan.penup() +dan.goto(-180, 160) +dan.begin_fill() +for myColor in color_list: + dan.color(myColor) + dan.pendown() + dan.begin_fill() + dan.circle(10) + dan.end_fill() + dan.penup() + dan.forward(20) +dan.hideturtle() +``` + ## Drawing ![](../img/green-circle.png) diff --git a/docs/trinket/08c-turtle-shapes.md b/docs/trinket/08c-turtle-shapes.md index 87591c1e..fa0c35f7 100644 --- a/docs/trinket/08c-turtle-shapes.md +++ b/docs/trinket/08c-turtle-shapes.md @@ -1,13 +1,13 @@ # Change the Turtle Shape -You can change your turtle shape to be any of the following: - -1. 'arrow' -2. 'turtle' -3. 'circle' -4. 'square' -5. 'triangle' -6. 'classic' +With the turtle shape() method we can change your turtle shape to be any of the following shapes + +1. arrow +2. turtle +3. circle +4. square +5. triangle +6. classic ```py import turtle diff --git a/mkdocs.yml b/mkdocs.yml index 670f84aa..71d23f4b 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -14,7 +14,7 @@ nav: - Flower: trinket/07-flower.md - Function Parameters: trinket/07-function-parameters.md - Lists: trinket/08-list.md - - Turtle Shape Lists: trinket/09-turtle-shapes.md + - List of Turtle Shapes: trinket/09-turtle-shapes.md - Random Numbers: trinket/08-random.md - Random Stars: trinket/13-random-stars.md - Input: trinket/11-input.md From 8b37e16bce541b89cebf0750b007d5a2da63af73 Mon Sep 17 00:00:00 2001 From: Dan McCreary Date: Sat, 30 Oct 2021 14:51:26 -0500 Subject: [PATCH 03/28] updates to markdown content --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 71d23f4b..8479c174 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -14,7 +14,7 @@ nav: - Flower: trinket/07-flower.md - Function Parameters: trinket/07-function-parameters.md - Lists: trinket/08-list.md - - List of Turtle Shapes: trinket/09-turtle-shapes.md + - List of Turtle Shapes: trinket/08c-turtle-shapes.md - Random Numbers: trinket/08-random.md - Random Stars: trinket/13-random-stars.md - Input: trinket/11-input.md From 1ef12355b7933f2d566acdd22d5f8b25c4cbc40c Mon Sep 17 00:00:00 2001 From: Dan McCreary Date: Mon, 1 Nov 2021 07:41:04 -0500 Subject: [PATCH 04/28] updates to markdown content --- docs/img/row-of-circles.png | Bin 0 -> 12776 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/img/row-of-circles.png diff --git a/docs/img/row-of-circles.png b/docs/img/row-of-circles.png new file mode 100644 index 0000000000000000000000000000000000000000..b082b601176f79b0180f5402acd59c2d920b3d9c GIT binary patch literal 12776 zcmZ9TV{j%w*QR6Jwr$&dVw;m>V%xTDPi%X_C)NZL+ctOJZ+ENS-9O#;>F(-ZU8lS5 zK39}7KpGJa4-Nzb1W{H-LKOrA4C_0A*;Pe{Z)kwu;p zNwGE_T5x@aCVat34=s}oq?n6BrzVXu;|KIyx0(OkZdcX#mCpU`rMjldm|XRc--oO! zZS?D`*JE4oIlnviJKyK3SB?Z_F0m*Uf(>n4hJ-xme~UmgWp>s7ivMS#7;PLRq>_Sd z8yD7`A~8us3haMGBaZpm|JDC{P(NK{)YMT2E6eD=R`%>u8s}v|jQS3&;uyz8N##8J zn7W;d83dyN_NU z&8a*}Tv&-=zNub!^Ud{;MOL7|1h!bpKm3X&pPHrlvk7Fre!0W}Wb?Ou>fGGTIi-`a!FNPR=}>nM zPJRj#|j|bCKcV<1G9Q6p!&8c81tzhmPXwwdnY#x}JNW*EG@^ zX4G(FV`F!wxwk`SsUMk$2pII*5HK+@$ALgOngn%wx~~%D&-Wq-y?w*Qi?m3d`oJS| zy=>|@<%f6Jr2={7Q&(jX$s3d4iD-yd#jw_K`P9cs4_C0+u^s}dNZ0O76iGf}G|JOQ zZ>N_VlZWT$F-b}bEq(pipY^?5S2|VP6m|P!3HuMHi%#`$fdu=;7a_zSB+kx96*~|p zuI|sf1C7m2zS^ksi`;>PTJ^t^v!h>*X}3^YiT}U|p!Y~GL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beX>D%{A`Y5+O z4v&dc=eRc>&t5}>h3mtc-QRphyK1VcV4&bCRlk1Cf5H{7H2X!sLIAj%!HvBlH-=eN ze33^p>)9DEPw)#@U?x=phsrr8b-t-mwd=;>$`9R|C510LwGm<9AAH`pyWQfFV(#K~ zF%Ev^ZqSh!v(Ydjp*sL#Y{O$_jJao3t-@2%_v{;qLc^^@am3y|`3(s-6@?+5kV{8v zT06LW{z@pA>t9w5C)aob$SH_d6(RCph^c6BaQg<}0V_?+#KgqA+95SN+%1Fav@ z0zpeQ3WCCTypxMt$jA(64-$>#aSDTk%>aoCgDpkJ9Ms_eDGhYOf@~6AWjS0@w>|XP z&tGaOw^)WG2@$IY^#G`w;Y_@fUu+FD$vZxnRjibVt zdF#s~b}q=(tL<8%^36PS^IkQwzq_|E%hQ6II3q_-O4ohLi7%no=Ns$A6FB>YkP*2# z3-{o%DGR;g$CEvOn4#6mX8~8jAPNuw=UxRbE z&)app+wUpGcOjCgz!a0{>gml(k&sbDiv`%P@aMT*`Qd=(Zj97pq2tg=Fnzp0g9;umC`{L~rFyQZV7w z0PgWZXZb$`n#0iNSlRf3XW{|5e3A{4(QoiDf$Y&@5S3!6LU{FoG$=c+x zWVfhrcOs2JCd}~#)}l(pLFD8aAxU-J-i+LGa-e}Tq$&#;a0oEy1SiAHpkQ~b(L)3V z$nzKhf3|~@t3V#dM$3pJ;7 A>Hq)$ literal 0 HcmV?d00001 From b04d338afc88e697f651b5365056da07982d30e5 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Thu, 14 Apr 2022 14:26:47 -0500 Subject: [PATCH 05/28] Add additional examples and correct links --- docs/img/night_sky.png | Bin 0 -> 7650 bytes docs/img/rocketpanda.png | Bin 0 -> 3947 bytes .../20-installing-local-python.md | 3 +- docs/intermediate/21-files.md | 122 ----------------- docs/intermediate/22-images.md | 11 -- docs/trinket/00-introduction.md | 16 ++- docs/trinket/08b-random-stars.md | 59 +++++++++ docs/trinket/08c-turtle-shapes.md | 7 + docs/trinket/13-random-stars.md | 38 ------ docs/trinket/13-shape-module.md | 16 ++- docs/trinket/14-color-picker.md | 31 ++++- docs/trinket/16-changing-background.md | 23 ++++ docs/trinket/17-controlling-mouseclicks.md | 112 ++++++++++++++++ mkdocs.yml | 18 ++- src/Untitled.ipynb | 60 --------- src/Untitled1.ipynb | 124 ------------------ src/Untitled2.ipynb | 52 -------- 17 files changed, 265 insertions(+), 427 deletions(-) create mode 100644 docs/img/night_sky.png create mode 100644 docs/img/rocketpanda.png delete mode 100644 docs/intermediate/21-files.md delete mode 100644 docs/intermediate/22-images.md create mode 100644 docs/trinket/08b-random-stars.md delete mode 100644 docs/trinket/13-random-stars.md create mode 100644 docs/trinket/16-changing-background.md create mode 100644 docs/trinket/17-controlling-mouseclicks.md delete mode 100644 src/Untitled.ipynb delete mode 100644 src/Untitled1.ipynb delete mode 100644 src/Untitled2.ipynb diff --git a/docs/img/night_sky.png b/docs/img/night_sky.png new file mode 100644 index 0000000000000000000000000000000000000000..0b519bb55e3d7834fa3b340e9d7239806b68f818 GIT binary patch literal 7650 zcmV<89UbC{P)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00006 zVoOIv0RI600RN!9r;`8x010qNS#tmY4#NNd4#NS*Z>VGd000McNliruoZ$}ZRQzRuaNwbq>DqcPV$kNYr* zg|c;Y?>T#~$6VhWk8gZqY-06ukbnRHiJ%}r00H6gF9QLRA^?y882BrA$sh<(AGxRY%uWyWKuQASkfGW`NMpxO{EkfDvXq|7u_YApRtz zh&V@TKJp=?^q3QgE320TfV}$HG|>ShlDo|gq>=5=_IZPV=N2|Egv8;FPcpmz@2_@i zLV6e}5=N^LfJ_&UEdWG;_iofJ5 zrBv%rI*V5f_NPI4_9<07`4nC@5Vp&!UOJwSF{>a65|T8B=~4sI#YWP>3&f4*pw2&k z38bRNYp=eLbAHm3lkB?uQ(NDR6amE*q^@4@a#2<aduZ0X?ta;v zFDF3(LE$0)f_N#|nK5_X|SiN=t6Zm}WF-{EJ{jvhTYm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vlQp6OgSpr_5__y)Ve_V!+}Us<3{+{#c) zxhEuPO+J&AT-9MH4*g=A8!HvQ$c%j8WNr9VD>GGxHSUBd!8X*_n1d)%8K|S#*x_%E zwk!m;Y@ScDeDXdkRejIi+-kibF?bbp8y*T2A?sJI-x`hE|FDuj1&T&szHOD9UAVl7 zrcGaLkOa91?%#342bi<5kYpbYw=*4sdD(#|lou_|A6Q?97#7~t6t8D&FM3lEE0teF zow#Fdnnm_076<+sI&{5&sX&qQ&aW~tTL%bA#x_XWM=`m&N`iG=EWhZoI?#Q|o z6hVWmwGQHt1>Fgz>t6CRBk8PH9q-0H{QNFxSz!HKDe zQ%43RN&N2gcd>Sq`S6%QQ>2M!AFpWb$TF~^0It4Ww6wyMh&WrJOEP;m1xw*05Psv_ zZK~69{x?Ari4^)5Avq%h2>8{<^OnDsxxb^GzmtN4uhW$PNJ~mf-IWC2m6kD)mR69J rQ;?Jwmy}eHlzf5xKLb3x9A7wx{Qm>kKiXe^q5(Qu`kFQBwy^&K2F#~V literal 0 HcmV?d00001 diff --git a/docs/intermediate/20-installing-local-python.md b/docs/intermediate/20-installing-local-python.md index 13ba2762..cc9d8776 100644 --- a/docs/intermediate/20-installing-local-python.md +++ b/docs/intermediate/20-installing-local-python.md @@ -3,8 +3,7 @@ The next few labs are labs that must be run on your local computer because the will interact with the local operating system and local file system. You will not be able to use Trinket to run these programs. The main site for Python is here: - - [https://www.python.org/](https://www.python.org/) +[https://www.python.org/](https://www.python.org/) If you go to that site there will be pages for Downloads and Documentation for each version of your desktop or PC. diff --git a/docs/intermediate/21-files.md b/docs/intermediate/21-files.md deleted file mode 100644 index 2204a95c..00000000 --- a/docs/intermediate/21-files.md +++ /dev/null @@ -1,122 +0,0 @@ -# Reading and Writing Files in Python - -Most of the initial labs until now used the Trinket web site to teach you how to program Python. Although many of these labs use Trinket, some of the labs in the intermediate class need access to your local file system to learn how to open and manipulate files. To do this you must install Python on your local computer. - -To install Python on your computer visit the [Python.org](https://www.python.org) web site and follow the installation instructions for your computer operating system (Windows, Mac, Linux etc.) - -At this point you should now have python installed on your computer and no longer be using trinket.io. We recommend [installing Anaconda](https://www.anaconda.com/products/individual) and using the Spyder integrated development environment (IDE). - -Python makes it easy to read and write text files. The general syntax for opening a file is as follows: - -```file = open('/file/path/filename.txt', 'mode')``` - -The first argument is the path the file on your computer. If the file you're trying to open is in the same folder as your python script you can just input the filename, if not you'll need the path to file. For example, let's say you're using a Mac, your username is Bella, and you're trying to open a file called "myfile.txt" in your downloads folder. The path to that file would be: ```/Users/Bella/Downloads/myfile.txt``` - -Valid arguments for the mode parameter are: - -* 'w': writing to a file, this will overwrite a file if it already exists. -* 'a': append to a file, you can add new lines to a file that already exists, otherwise it will create the file. -* 'r': to read a file. - -### Reading Files - -For our example we're going to [download](https://www.gutenberg.org/files/2701/old/moby10b.txt) Herman Melville's _Moby-Dick_ from the Gutenberg Project to read. - -```python - f = open("/Users/Bella/Downloads/moby10b.txt","r") - - ### Let's take all the lines in Moby-Dick and store them in a list! - - lines = f.readlines() - - ### Close the file - - f.close() -``` - -Calling the ```.readlines()``` method on a file is very useful. If we wanted to do this manually, we would iterate over the lines in the file and add them one by one to a list. - -```python - - f = open("/Users/Bella/Downloads/moby10b.txt","r") - - lines = [] #define empty list - - for line in f: - lines.append(line) #we can use the .append() method to add new items to a list! - - f.close() -``` - -Let's say we needed to know exactly how many times each word appears in _Moby-Dick_: how might we do that? We'd have to account for things like punctuation, captalization and newline characters ('\n'). We'd also need to get every word by itself. - -```python -from string import punctuation #punctuation from the string library is a string that contains all punctuation marks -#you can run print(punctuation) to see what this looks like - -punctuation_list = list(punctuation) #convert string of punctuation marks to list - - -f = open("/Users/Bella/Downloads/moby10b.txt", "r") #open Moby-Dick file -lines = f.readlines() #put all lines from Moby-Dick into a list -f.close() #close the file - -clean_lines = [] #empty list for lines stripped of newline characters and all characters converted to lowercase - -for line in lines: #go through every line in the file - clean_line = line.strip("\n") #get rid of new-line characters - clean_line = clean_line.lower() #convert everything to lowercase - clean_lines.append(clean_line) #add cleaned line to clean_lines - -words={} #create empty dictionary for words - -for line in clean_lines: #go through every line in the file - for mark in punctuation_list: #go through every punctuation mark - line=line.replace(mark,"") #use replace method to replace each possible punctuation mark with an empty string - line_words=line.split(" ") #we're using the string split() method to separate each line by space character - #this converts the line to a list - #for example: "This is a sentence.".split(" ") --> ['This', 'is', 'a', 'sentence.'] - for word in line_words: #iterate over every word in the line - if word not in words: # if we haven't seen this word yet - words[word]=1 #add it to the words dictionary, and mark the count as 1 - else: - words[word]+=1 #we've already seen this word, so increment the count by 1 -``` - -The method we used above to remove punctuation characters from the lines is not the most computationally efficent. We're going to learn a better way to do this in the section on Regex expressions. - -One thing we left out from the mapping section is that you can iterate over a dictionary using the .items() method. Here's what that looks like: - -```python - -my_dict = {1:"one",2:"two",3:"three"} - -for key, value in my_dict.items(): - print(key, value) -#this prints: -#1 one -#2 two -#3 three -``` - -### You Try It! -If you recall, a dictionary is an unordered data structure. Use what we learned about iterating over items in a dictionary to determine what word occurs the most frequently in _Moby-Dick_! - -### Writing Files - -Let's say we wanted to write out _Moby-Dick_ with no capital letters. Here's how we could approach that: - -```python - -f = open("/Users/Bella/Downloads/moby10b.txt", "r") #open Moby-Dick file -lines = f.readlines() #put all lines from Moby-Dick into a list -f.close() #close the file - -new_file = open("/Users/Bella/Documents/moby-dick_lowercase.txt", "w") #write new file to Documents folder - -for line in lines: - new_file.write(line.lower()) - -new_file.close() - -``` \ No newline at end of file diff --git a/docs/intermediate/22-images.md b/docs/intermediate/22-images.md deleted file mode 100644 index 0b20b711..00000000 --- a/docs/intermediate/22-images.md +++ /dev/null @@ -1,11 +0,0 @@ -# Reading Images in Python - -Opening and displaying images in Python is pretty straightforward. It's a bit different than opening text files though. To open an image, let's use Python's built-in pil library. - -```python -from PIL import Image -my_image = Image.open("/path/to/image.jpg") -my_image.show() -``` - -The CoderDojo AI Racing League will explore more around working with image data. \ No newline at end of file diff --git a/docs/trinket/00-introduction.md b/docs/trinket/00-introduction.md index 9f439aff..b106b414 100644 --- a/docs/trinket/00-introduction.md +++ b/docs/trinket/00-introduction.md @@ -17,16 +17,20 @@ The map above is a visual guide to our Introduction to Python course. Students For students that are new to programming, here are some sample programs (what we call learning labs) that you can try. You can learn by reading the sample programs, going to the Trinkit.io site and changing some values in the code. Each of the labs has experiments at the end you can do to extend to see if you have mastered the concepts before you go on to the next lab. 1. [Trinket Account](./01a-trinket-account.md) - introduction to the Turtle Graphs library with a list of drawing functions -1. [Turtle graphics](./01a-turtle-graphics.md) - introduction to the Turtle Graphs library with a list of drawing functions -2. [Simple square](./02-simple-square.md) - draw a square by moving and turning right four times +2. [Turtle graphics](./01b-turtle-graphics.md) - introduction to the Turtle Graphs library with a list of drawing functions +3. [Simple square](./02-simple-square.md) - draw a square by moving and turning right four times 4. [Variables](./03-variables.md) - add variables for the move edge distance and angle 5. [Loops](./04-loops.md) - add a loop to make our code smaller 6. [Conditionals](./05-conditionals.md) - add an if statement to change the color 7. [Functions](./06-functions.md) - create a shape function 8. [Function parameters](./07-function-parameters.md) - add parameters to our function 9. [Random](./08-random.md) - generate random numbers that are used do drive the turtle -9. [Lists](./08-list.md) - store a list of colors -10. [Inputs](./11-input.md) - get some input from the user -11. [Recursion](./12-recursion.md) - create a function that calls itself to draw a tree - +10. [Lists](./08-list.md) - store a list of colors +11. [Inputs](./11-input.md) - get some input from the user +12. [Recursion](./12-recursion.md) - create a function that calls itself to draw a tree +13. [Shapes](./13-shape-module.md) - creating a separate module to draw shapes +14. [Color picker](./14-color-picker.md) - picking different colors +15. [Sine wave](./15-sine-wave.md) - creating a sine wave +16. [Changing Background](./16-changing-background.md) - changing background image and capturing keyboard +17. [Controlling MouseClicks](./17-controlling-mouseclicks.md) - Tracking mouse clicks diff --git a/docs/trinket/08b-random-stars.md b/docs/trinket/08b-random-stars.md new file mode 100644 index 00000000..d93b9365 --- /dev/null +++ b/docs/trinket/08b-random-stars.md @@ -0,0 +1,59 @@ +## Random Circles + +In this exercise we will draw 5 stars of different colors: +The colors are randomly picked from the list of colors +``` +colorList = ['red', 'orange', 'green', 'blue', 'purple', 'pink', 'brown', 'gray', 'gold'] +mycolor = colorList[random.randint(0,len(colorList)-1)] +``` +After these line runs, the variable mycolor will be assigned some random color from the list of colors myColorList. We will then use this color to fill a star. +The stars are drawn at random locations selected in x = random.randint(-max_distance, max_distance) + y = random.randint(-max_distance, max_distance) + The size of star is also randomly picked size = random.randint(15, 30) + +## Sample Code +```python +import turtle +import random +# this is a list of colors +colorList = ['red', 'orange', 'green', 'blue', 'purple', 'pink', 'brown', 'gray', 'gold'] +dan = turtle.Turtle() +dan.shape('turtle') +dan.delay(1) +dan.clear() +dan.penup() + +max_distance = 160 + +# draw an eight sided star +def star(x, y, size, color): + dan.goto(x, y) + dan.color(colorList[random.randint(0,len(colorList)-1)]) + dan.pendown() + dan.begin_fill() + for i in range(1,8): + dan.forward(size) + dan.right(150) + dan.forward(size) + dan.left(100) + dan.end_fill() + dan.right(10) + dan.penup() + +# draw a pattern at a random location on the screen +for i in range(5): + x = random.randint(-max_distance, max_distance) + y = random.randint(-max_distance, max_distance) + size = random.randint(15, 30) + color_index = random.randint(0,8) + # draw a star with size and color + star(x,y,size, color_index) + +# hide so we have a nice drawing +dan.hideturtle() +``` + + +## Experiments +1. Can you create a variable for the number of circles to draw? +2. Go to the [Trinket colors page](https://trinket.io/docs/colors) and see the name of other colors you can use. Note that you can use any of these colors in your lists. diff --git a/docs/trinket/08c-turtle-shapes.md b/docs/trinket/08c-turtle-shapes.md index fa0c35f7..a6a7c1d3 100644 --- a/docs/trinket/08c-turtle-shapes.md +++ b/docs/trinket/08c-turtle-shapes.md @@ -41,3 +41,10 @@ for myShape in myList: dan.shape(myShape) time.sleep(1) ``` + + +##Sample program +[Sample](https://trinket.io/library/trinkets/c9924a123a) + +## Experiments +Can you use the new shapes to draw a star or any other shape of your chosing \ No newline at end of file diff --git a/docs/trinket/13-random-stars.md b/docs/trinket/13-random-stars.md deleted file mode 100644 index f5a66ce3..00000000 --- a/docs/trinket/13-random-stars.md +++ /dev/null @@ -1,38 +0,0 @@ -import turtle -import random -# this is a list of colors -colorList = ['red', 'orange', 'green', 'blue', 'purple', 'pink', 'brown', 'gray', 'gold'] -dan = turtle.Turtle() -dan.shape('turtle') -dan.delay(1) -dan.clear() -dan.penup() - -max_distance = 160 - -# draw an eight sided star -def star(x, y, size, color): - dan.goto(x, y) - dan.color(colorList[random.randint(0,len(colorList)-1)]) - dan.pendown() - dan.begin_fill() - for i in range(1,8): - dan.forward(size) - dan.right(150) - dan.forward(size) - dan.left(100) - dan.end_fill() - dan.right(10) - dan.penup() - -# draw a pattern at a random location on the screen -for i in range(5): - x = random.randint(-max_distance, max_distance) - y = random.randint(-max_distance, max_distance) - size = random.randint(15, 30) - color_index = random.randint(0,8) - # draw a star with size and color - star(x,y,size, color_index) - -# hide so we have a nice drawing -dan.hideturtle() \ No newline at end of file diff --git a/docs/trinket/13-shape-module.md b/docs/trinket/13-shape-module.md index 1238f904..fa7b58a1 100644 --- a/docs/trinket/13-shape-module.md +++ b/docs/trinket/13-shape-module.md @@ -2,9 +2,23 @@ In this lab we will create a set of drawing function and put them together into a new file. We will then import this file into our main.py file. +Example code to import the module in main.py +``` py +import turtle +from shape import * +dan = turtle.Turtle() +dan.shape('turtle') + +draw_triangle(dan, 'red', 5, 20, 30) + +draw_circle(dan, 'orange', 10, 0, 30) -## Sample Code +draw_square(dan, 'orange', 15, -20, 30) ``` + + +## Sample Codeimited t +```py # This is a custom module we've made. # Modules are files full of code that you can import into your programs. # This one teaches our turtle to draw various shapes. diff --git a/docs/trinket/14-color-picker.md b/docs/trinket/14-color-picker.md index 453150df..0febf292 100644 --- a/docs/trinket/14-color-picker.md +++ b/docs/trinket/14-color-picker.md @@ -1,3 +1,32 @@ ## Color Picker -[Color Picker](https://projects.raspberrypi.org/en/projects/colourful-creations/1) \ No newline at end of file +You are not limited to the colors by name [Trinket Colors](https://trinket.io/docs/colors). +You can use Hex and RGB values and let your imagination run wild. + +[Color Picker](https://projects.raspberrypi.org/en/projects/colourful-creations/1) + +#Example code +```py + +import turtle + +#turtle.setup(400,500) +wn = turtle.Screen() +wn.setup(400,500) +#turtle.title("Tess becomes a traffic light!") +wn.bgcolor("A7E30E") +tess = turtle.Turtle() +tess.color('#FA057F') +style = ('Arial', 40, 'bold') +tess.write('Hello', font=style, align='Center') +tess.hideturtle() + +``` + +## Experiments +Can you try different colors? +Can you change font properties in style object? + +The font name can as 'Arial', 'Courier', or 'Times New Roman' +The font size in pixels. +The font type, which can be 'normal', 'bold', or 'italic' \ No newline at end of file diff --git a/docs/trinket/16-changing-background.md b/docs/trinket/16-changing-background.md new file mode 100644 index 00000000..4472b727 --- /dev/null +++ b/docs/trinket/16-changing-background.md @@ -0,0 +1,23 @@ +## Changing background and using keys to move the rocket + +We can use trinkets to change the background and change the shape of the turtle with a custom image. +Also we can control the screen with the mouse. It gives a starting point for how to create a game. + +The following blog lays out the steps for creating a rocket ship +https://blog.trinket.io/using-images-in-turtle-programs/ + + +The images have to be the same size as the the screen size. Here are some other images that have been resized. + +#Background +![Night Sky matching screen size](../img/night_sky.png) + +#Rocketpanda +![Rocket panda](../img/rocketpanda.png) + +## Sample Program +[Sample](https://trinket.io/library/trinkets/eacf1bc102) + +## Experiments +1. Can you map another keyboard key to take some other actions like jump, draw a circle. +2. Use different images and create backgrounds of your choice, like rocketpanda gliding through night sky diff --git a/docs/trinket/17-controlling-mouseclicks.md b/docs/trinket/17-controlling-mouseclicks.md new file mode 100644 index 00000000..d0850623 --- /dev/null +++ b/docs/trinket/17-controlling-mouseclicks.md @@ -0,0 +1,112 @@ +## Getting a handle of the mouse clicks + +We can use trinkets to change the background and control mouse clicks. +Also we have access to the exact position where the mouse was clicked. That creates a lot of possibilities +for creating different interactions with the screen. + +Code to change screen color + +Code to get co-ordinates of mouse click +```py + x=turtle.xcor() + y=turtle.ycor() +``` + +Here is an example of setting the screen color. We then draw a square in the center of the screen. +When the user clicks a circle is drawn within the circle. On next click the circle increases in diameter. When the circle touches the square, it stops increaing in size. + +If the user clicks the screen outside the square the screen is refreshed + +```py + + +#import packages +import turtle +import random + +# global colors +col = [ 'yellow', 'green', 'blue', + 'white', 'orange', 'pink'] +circlecol = [ 'red', 'magenta', 'purple', + 'black', 'brown', 'turqouise' ] +# method to call on screen click +tina = turtle.Turtle() +circlediameter=10 +squaresize = 200 + +def drawCircleOnMouseClick(x, y): + global circlecol + global circlediameter + print(" x={}, y={}".format(x,y)) + + ##If mouse is clicked within square increase size, if mouse clicked outside reset screen + if (isMouseClickWithinSquare(x,y)) : + ## Check if diameter is same size as square + if (circlediameter <= squaresize/2): + print(" circlediameter={}, squaresize={}".format(circlediameter,squaresize)) + ##If yes do not increase the size else increase the size + circlediameter += 10 +##If mouse is clicked outside the square, reset the screen - draw a new square + else: + screenreset() + + + draw_circle(tina, circlediameter, getCircleColor() ) + +def getBgColor(): + ind = random.randint(0, 5) + return col[ind] + +def getCircleColor(): + ind = random.randint(0, 5) + return circlecol[ind] + +def drawsquare(turtle, size, color, startx, starty): + turtle.penup() + turtle.goto(startx, starty) + turtle.pendown() + turtle.fillcolor(color) + turtle.color(color) + turtle.begin_fill() + for i in range(4): + turtle.forward(size) + turtle.left(90) + turtle.end_fill() + +def draw_circle(turtle, diameter, color): + turtle.penup() + turtle.goto(0, -diameter) + turtle.pendown() + turtle.fillcolor(color) + turtle.color(color) + turtle.begin_fill() + turtle.circle(diameter) + turtle.end_fill() + +def screenreset(): + tina.reset() + drawsquare(tina, squaresize, getBgColor(), -100, -100 ) + +def isMouseClickWithinSquare(x, y): + return (x >= -100 and x <= 100 and y >= -100 and y <= 100) +# set screen +sc = turtle.Screen() +sc.setup(400, 400) +sc.bgcolor('skyblue') +screenreset() + +##Screen can respond to mouseclick and we can tell it what action to take i.e. method to call + + +# call method on screen click +sc.onscreenclick(drawCircleOnMouseClick) +``` + +##Sample Program +[Sample](https://trinket.io/library/trinkets/0c79d0d02a) + +## Experiments +1. Can you draw different shapes +2. Can you add some more colors in the arrays +3. Can you change background color of the screen +4. Can you try some other [events](https://docs.python.org/2.7/library/turtle.html#methods-of-turtlescreen-screen) \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 8479c174..5c9a9ceb 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -16,11 +16,15 @@ nav: - Lists: trinket/08-list.md - List of Turtle Shapes: trinket/08c-turtle-shapes.md - Random Numbers: trinket/08-random.md - - Random Stars: trinket/13-random-stars.md + - Random Stars: trinket/08b-random-stars.md - Input: trinket/11-input.md - Recursion: trinket/12-recursion.md - Shape Module: trinket/13-shape-module.md + - Color Picker: trinket/14-color-picker.md - Sine Wave: trinket/15-sine-wave.md + - Changing background: trinket/16-changing-background.md + - Controlling mouseclicks: trinket/17-controlling-mouseclicks.md + - Other examples: trinket/examples.m - Beginning Python - Repl.it: - Square: repl/02-square.md - Flower: repl/07-flower.md @@ -32,24 +36,18 @@ nav: - Data Types: intermediate/02-data-types.md - Data Types & Function Parameters: intermediate/03-data-type-validation.md - Maps: intermediate/04-maps.md - - Modules: intermediate/07-modules.md - - Dir: intermediate/08-dir.md - - Regular Expressions: intermediate/09-regex.md - - Files (local file system): intermediate/05-files.md - - Images (local file system): intermediate/06-images.md - - - Debugging (vscode): intermediate/10-debugging.md + - Images (local file system): intermediate/06-images.md - JSON: intermediate/05-json.md - Object Classes: intermediate/06-object-classes.md - Modules: intermediate/07-modules.md - Dir: intermediate/08-dir.md - Regular Expressions: intermediate/09-regex.md - - Files: intermediate/05-files.md - - Images: intermediate/06-images.md - Debugging: intermediate/10-debugging.md + - Plotting sine: intermediate/12-plot-sin.md - Maze Solving with BFS: intermediate/bfsMaze.md - Maze Solving with DFS: intermediate/dfsMaze.md + - Installing Python: intermediate/20-installing-local-python.md - Jupyter: - Setup Turtle on Jupyter: jupyter/01-setup.md - Drawing Box Labs: jupyter/02-draw-box.md diff --git a/src/Untitled.ipynb b/src/Untitled.ipynb deleted file mode 100644 index 9178bb36..00000000 --- a/src/Untitled.ipynb +++ /dev/null @@ -1,60 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "44cd4b90bb0940d682af9142be102085", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Turtle()" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "from ipyturtle import Turtle\n", - "t = Turtle()\n", - "t.forward(100)\n", - "t.right(90)\n", - "t" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "turtle", - "language": "python", - "name": "turtle" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.10" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/src/Untitled1.ipynb b/src/Untitled1.ipynb deleted file mode 100644 index a5418b28..00000000 --- a/src/Untitled1.ipynb +++ /dev/null @@ -1,124 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - } - ], - "source": [ - "import turtle\n", - "bob = turtle.Turtle()\n", - "print(bob)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "for i in range(8):\n", - " bob.fd(50)\n", - " bob.lt(45)\n", - "bob" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "t = turtle.Turtle()\n", - "t.clear()\n", - "t\n" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from ipyturtle import Turtle\n", - "t = turtle.Turtle()\n", - "t.clear()\n", - "t.color('blue')\n", - "t.pensize(5)\n", - "for i in range(8):\n", - " t.fd(50)\n", - " t.rt(45)\n", - "t" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "turtle", - "language": "python", - "name": "turtle" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.10" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/src/Untitled2.ipynb b/src/Untitled2.ipynb deleted file mode 100644 index 6ff9c7f0..00000000 --- a/src/Untitled2.ipynb +++ /dev/null @@ -1,52 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "2" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "1+1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.2" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} From c5c25c039a142b6c5e15e51a4e0f4b0036d54609 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Thu, 14 Apr 2022 14:39:24 -0500 Subject: [PATCH 06/28] Fixed links --- docs/trinket/examples.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/trinket/examples.md b/docs/trinket/examples.md index ac6444f8..017661c8 100644 --- a/docs/trinket/examples.md +++ b/docs/trinket/examples.md @@ -1,6 +1,8 @@ # Trinket Examples -1. Bullseye Dart Game - https://trinket.io/python/90130df21a -2. Tic Tac Toe Game - https://trinket.io/library/trinkets/3913dfe7af -3. How to Find Prime Numbers? - https://trinket.io/library/trinkets/aa9d51a7b9 -4. Drawing an Elephant - https://trinket.io/library/trinkets/9202036e6a +1. [Bullseye Dart Game](https://trinket.io/python/90130df21a) +2. [Tic Tac Toe Game](https://trinket.io/library/trinkets/3913dfe7af) +3. [How to Find Prime Numbers?](https://trinket.io/library/trinkets/aa9d51a7b9) +4. [Drawing an Elephant](https://trinket.io/library/trinkets/9202036e6a) + +Use the [Turtle API](https://docs.python.org/2.7/library/turtle.html) documentation to check out what else is available. From 1a9a04a37f91b98b6ef4cd7da45d50b133043835 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 11:19:19 -0500 Subject: [PATCH 07/28] Change actions --- .github/workflows/main.yml | 2 ++ mkdocs.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb7b99c4..09e42bff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,6 +5,8 @@ name: Build Documentation using MkDocs on: push: branches: [master] + paths: + - '**.yml' pull_request: branches: [master] diff --git a/mkdocs.yml b/mkdocs.yml index 5c9a9ceb..2a05bca5 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -3,7 +3,7 @@ nav: - CoderDojo TC: https://coderdojotc.github.io/CoderDojoTC/ - Beginning Python - Trinket: - Introduction: trinket/00-introduction.md - - Using Trinket: trinket/01a-trinket-account.md + - Setting Up Trinket: trinket/01a-trinket-account.md - Turtle Graphics: trinket/01b-turtle-graphics.md - Turtle Square: trinket/02-simple-square.md - Variables: trinket/03-variables.md From 9e759ee2018544ddbb658bf1f3e3595e244d687b Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 11:27:49 -0500 Subject: [PATCH 08/28] Change version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 09e42bff..50f7404a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Master - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python 3.7 uses: actions/setup-python@v2 From d54569fea01d44ef7f7304ad5959437d6f21cc78 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 12:24:54 -0500 Subject: [PATCH 09/28] Trying deploy-pages --- .github/workflows/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 50f7404a..f64f9831 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,9 @@ jobs: pip install mkdocs-material - name: Deploy - run: | - git pull - mkdocs gh-deploy + uses: actions/deploy-pages@v1 + # with: + # branch: master # The branch the action should deploy to. + # run: | + # git pull + # mkdocs gh-deploy From 36edb0d9720e25ee1ab6493047cc849d76a862d3 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 12:27:36 -0500 Subject: [PATCH 10/28] add github token --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f64f9831..84703f95 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,6 +10,9 @@ on: pull_request: branches: [master] +env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + jobs: build: name: Build and Deploy Documentation From 0a282f9c20c7e0f8d1456e2997fb19e1b4a6d76b Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 13:09:02 -0500 Subject: [PATCH 11/28] test permissions --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 84703f95..58382b77 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,6 +17,9 @@ jobs: build: name: Build and Deploy Documentation runs-on: ubuntu-latest + permissions: + contents: 'read' + id-token: 'write' steps: - name: Checkout Master uses: actions/checkout@v3 @@ -31,6 +34,10 @@ jobs: python -m pip install --upgrade pip pip install mkdocs-material + - name: Check + run: | + pwd + ls -la - name: Deploy uses: actions/deploy-pages@v1 # with: From a4fab901afc81ce1cbcf8ca156384d0b726d75b2 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 13:11:03 -0500 Subject: [PATCH 12/28] Correct syntax --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58382b77..0fa04f3a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,8 +36,8 @@ jobs: - name: Check run: | - pwd - ls -la + pwd + ls -la - name: Deploy uses: actions/deploy-pages@v1 # with: From 8822fb0525bc30a2be2b43e0c7d9f91e24526d02 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 13:29:50 -0500 Subject: [PATCH 13/28] change depth --- .github/workflows/main.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0fa04f3a..4abcb8b7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,6 +23,16 @@ jobs: steps: - name: Checkout Master uses: actions/checkout@v3 + - uses: actions/checkout@v2 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + + - uses: actions/checkout@v3 + if: github.event_name == 'push' + with: + fetch-depth: 0 - name: Set up Python 3.7 uses: actions/setup-python@v2 @@ -39,9 +49,8 @@ jobs: pwd ls -la - name: Deploy - uses: actions/deploy-pages@v1 # with: - # branch: master # The branch the action should deploy to. - # run: | - # git pull - # mkdocs gh-deploy + # branch: master # The branch the action should deploy to. + run: | + git pull + mkdocs gh-deploy From 61653385b64fdf744200a408095154837786f5f7 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 13:31:35 -0500 Subject: [PATCH 14/28] syntax issue --- .github/workflows/main.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4abcb8b7..7037a0f3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,15 +21,16 @@ jobs: contents: 'read' id-token: 'write' steps: - - name: Checkout Master + - name: Checkout Branch uses: actions/checkout@v3 - - uses: actions/checkout@v2 + if: github.event_name == 'pull_request' with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} - - uses: actions/checkout@v3 + - name: Checkout Master + uses: actions/checkout@v3 if: github.event_name == 'push' with: fetch-depth: 0 From 779e8900656bf6b240d7e3263a87f3326b38e303 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 13:34:58 -0500 Subject: [PATCH 15/28] syntax --- .github/workflows/main.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7037a0f3..1d30014c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,17 +23,16 @@ jobs: steps: - name: Checkout Branch uses: actions/checkout@v3 - - if: github.event_name == 'pull_request' - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} - - name: Checkout Master - uses: actions/checkout@v3 - if: github.event_name == 'push' - with: - fetch-depth: 0 + - name: Checkout Master + uses: actions/checkout@v3 + if: github.event_name == 'push' + with: + fetch-depth: 0 - name: Set up Python 3.7 uses: actions/setup-python@v2 From 53a84d9340cfe7e35e9588bf4c951f86f6e40454 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 15:25:14 -0500 Subject: [PATCH 16/28] permissions --- .github/workflows/main.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d30014c..fe0fffb7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,16 +13,20 @@ on: env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} +permissions: + contents: 'read' + id-token: 'write' + pull-requests: 'write' jobs: build: name: Build and Deploy Documentation runs-on: ubuntu-latest - permissions: - contents: 'read' - id-token: 'write' + steps: - name: Checkout Branch uses: actions/checkout@v3 + with: + persist-credentials: false if: github.event_name == 'pull_request' with: fetch-depth: 0 @@ -30,6 +34,8 @@ jobs: - name: Checkout Master uses: actions/checkout@v3 + with: + persist-credentials: false if: github.event_name == 'push' with: fetch-depth: 0 @@ -43,6 +49,7 @@ jobs: run: | python -m pip install --upgrade pip pip install mkdocs-material + run: git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' - name: Check run: | From 35525bcfae942a4baf92a497272e994c439d57c6 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 15:26:33 -0500 Subject: [PATCH 17/28] syntax --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe0fffb7..44a0c98a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,8 +25,8 @@ jobs: steps: - name: Checkout Branch uses: actions/checkout@v3 - with: - persist-credentials: false + with: + persist-credentials: false if: github.event_name == 'pull_request' with: fetch-depth: 0 @@ -34,8 +34,8 @@ jobs: - name: Checkout Master uses: actions/checkout@v3 - with: - persist-credentials: false + with: + persist-credentials: false if: github.event_name == 'push' with: fetch-depth: 0 From adf35cb8fd45324e440b09a651fd82f272088150 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 15:28:29 -0500 Subject: [PATCH 18/28] syntax --- .github/workflows/main.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 44a0c98a..c8372666 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,20 +25,18 @@ jobs: steps: - name: Checkout Branch uses: actions/checkout@v3 - with: - persist-credentials: false if: github.event_name == 'pull_request' with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} + persist-credentials: false - name: Checkout Master uses: actions/checkout@v3 - with: - persist-credentials: false if: github.event_name == 'push' with: fetch-depth: 0 + persist-credentials: false - name: Set up Python 3.7 uses: actions/setup-python@v2 From 2d69ce65b1608da90a6335675aa85723c1cde666 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Mon, 18 Apr 2022 22:47:53 -0500 Subject: [PATCH 19/28] chg user --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8372666..c99ec1d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} permissions: - contents: 'read' + contents: 'write' id-token: 'write' pull-requests: 'write' jobs: @@ -33,6 +33,7 @@ jobs: - name: Checkout Master uses: actions/checkout@v3 + if: github.event_name == 'push' with: fetch-depth: 0 @@ -47,7 +48,7 @@ jobs: run: | python -m pip install --upgrade pip pip install mkdocs-material - run: git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' + git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' - name: Check run: | From 266e883988aa6eab65ec1fa43b41de993fe0a5cf Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Tue, 19 Apr 2022 22:28:49 -0500 Subject: [PATCH 20/28] remove git commands --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c99ec1d5..00e8cc11 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: run: | python -m pip install --upgrade pip pip install mkdocs-material - git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' + # git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' - name: Check run: | From 8b5fab842ed39e791dce4cca4ec75a0d43d72340 Mon Sep 17 00:00:00 2001 From: Richa Singh Date: Thu, 21 Apr 2022 09:35:29 -0500 Subject: [PATCH 21/28] Remove commented code --- .github/workflows/main.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 00e8cc11..efead2d0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,8 +5,6 @@ name: Build Documentation using MkDocs on: push: branches: [master] - paths: - - '**.yml' pull_request: branches: [master] @@ -48,15 +46,12 @@ jobs: run: | python -m pip install --upgrade pip pip install mkdocs-material - # git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' - + - name: Check run: | pwd ls -la - name: Deploy - # with: - # branch: master # The branch the action should deploy to. run: | git pull mkdocs gh-deploy From 285a2a2671bc38a286503dc62a8b8f9006b38ef5 Mon Sep 17 00:00:00 2001 From: Dan McCreary Date: Thu, 26 May 2022 11:44:52 -0500 Subject: [PATCH 22/28] updates to markdown content --- mkdocs.yml | 2 +- src/draw-for-squares-input-colors.py | 36 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/draw-for-squares-input-colors.py diff --git a/mkdocs.yml b/mkdocs.yml index 2a05bca5..0b1d4be1 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -67,7 +67,7 @@ nav: site_description: 'Resources for teaching Python to CoderDojo Twin Cities students.' site_author: 'Dan McCreary' -repo_name: 'python' +repo_name: 'GitHub Repo' repo_url: 'https://github.com/CoderDojoTC/python' # CoderDojo Standards from here down diff --git a/src/draw-for-squares-input-colors.py b/src/draw-for-squares-input-colors.py new file mode 100644 index 00000000..c52d21f0 --- /dev/null +++ b/src/draw-for-squares-input-colors.py @@ -0,0 +1,36 @@ +# J.E. Tannenbaum +# Released: 11/10/2021 - Initial release +# 11/10/2021 - Cleaned up and added comments +# https://trinket.io/python/94326b4743 + +import turtle # Load the library +jet = turtle.Turtle() # Create the turtle object and name it +jet.shape("turtle") # Set the shape + +def drawIt(color, distance, angle): + jet.color(color) + jet.begin_fill() + jet.forward(distance) + jet.right(angle) + jet.forward(distance) + jet.right(angle) + jet.forward(distance) + jet.right(angle) + jet.forward(distance) + jet.end_fill() + +# Set the distance and angle variables +distance = 40 +angle = 90 + +colors = [] +for i in range(4): + color = input("Enter a color:") + colors = colors + [color] + +for color in colors: + drawIt(color, distance, angle) + +# We are done, so hide the turtle +jet.hideturtle() + From 2fd07440e91de70c92d3fd224e7f266b19fe78c4 Mon Sep 17 00:00:00 2001 From: robertcrockett Date: Tue, 28 Jun 2022 15:33:35 -0400 Subject: [PATCH 23/28] Updated several spelling mistakes --- docs/index.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/index.md b/docs/index.md index 78afbb62..7dd08d13 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,30 +1,30 @@ # CoderDojo Twin Cities Python Resources -This GitHub repository is for sharing teaching resources to teach Python. This includes hints on getting your Python environments setup up and extensive lesson plans for serveral enviornments. +This GitHub repository is for sharing teaching resources to teach Python. This includes hints on getting your Python environments setup up and extensive lesson plans for several environments. -Our mentors have used several different envornments for teaching Python. They each have pros and cons. What our mentors like is getting new students started using a graphical programming environment such as turtle graphics libraries. Here are some of our favorite tools: +Our mentors have used several different environments for teaching Python. They each have pros and cons. What our mentors like is getting new students started using a graphical programming environment such as turtle graphics libraries. Here are some of our favorite tools: - [**Trinket.io**](http://trinket.io) is an easy-to use, kid friendly web-based turtle graphics for beginners. - [**Jupyter Notebooks**](https://jupyter.org/) also have some support for turtle graphics. Jupyter Notebooks can be tricky to setup for the first time, but they are the perfect on-ramp for teaching data literacy. - [**Raspberry Pi**](https://www.raspberrypi.org/documentation/usage/python/) - The Raspberry Pi foundation has selected Python as its primary tool for teaching programming. If you have a Raspberry Pi there are many resources for you. Trinket and Jupyter Notebooks will also run on many Raspberry Pi devices. - **Robots** Our students love robots. Python is also the preferred language in many robotics courses. Today we teach beginning robotics with Scratch and Arduino, but we continue to investigate systems like Raspberry Pi robots that can be programmed with Python. Let us know if you have any low-cost kid friendly ideas. We have tested the JetBot and other robots and we continue to look for solutions. -Now lets briefly go into the pros and cons of these systems. +Now let's briefly go into the pros and cons of these systems. ## Learning Python with Trinket -We use the [trinket.io](http://trinket.io) web site to teach our introduction to python. Trinket has a nice turtle graphics library which is ideal for fast visual feedback. Because it is a free and a pure web web based environment it meets the criteria for our courses. There is no complex setup and each student can continue to do development when they are at home. The downside of Trinket is it has limited functionality, only supports Python 2.X in the free version and you must have an internet connection to use Trinket. If you need Python 3.X web +We use the [trinket.io](http://trinket.io) web site to teach our introduction to python. Trinket has a nice turtle graphics library which is ideal for fast visual feedback. Because it is a free and a pure web-based environment it meets the criteria for our courses. There is no complex setup and each student can continue to do development when they are at home. The downside of Trinket is it has limited functionality, only supports Python 2.X in the free version and you must have an internet connection to use Trinket. If you need Python 3.X web version you can use the free [repl.id](https://repl.it/) web site. ## Learning Python with Jupyter Notebooks -You can also use Jupyter Notebooks to draw turtle graphics. The notebook will open a new window to draw your turtle graphis. Getting Jupyter Notebooks is a bit tricky to setup on many PCs. However, once it is setup it offers tens of thousands of sample programs to learn python coding. Jupyter Notebooks are also the preferred tool by many data science professionals. +You can also use Jupyter Notebooks to draw turtle graphics. The notebook will open a new window to draw your turtle graphics. Getting Jupyter Notebooks is a bit tricky to setup on many PCs. However, once it is setup it offers tens of thousands of sample programs to learn python coding. Jupyter Notebooks are also the preferred tool by many data science professionals. An example of a Jupyter Notebook that uses turtle graphs is [here](jupyter/draw-figure.ipynb) ## Learning Python with Raspberry Pi -If you have a Rasperry Pi there are many great ways to learn Python. One of first things is to try out one of the Python development environments for the Raspberry Pi. +If you have a Raspberry Pi there are many great ways to learn Python. One of first things is to try out one of the Python development environments for the Raspberry Pi. ## Learning Python with Robots -Right now we are continuing to try to find the right combination of easy-of-use and low-cost robots to teach python. If you hear of any good tools, please let us know. +Right now, we are continuing to try to find the right combination of easy-of-use and low-cost robots to teach python. If you hear of any good tools, please let us know. ## Target Audience Learning Python is ideal for students that have good keyboarding skills. If students have difficulty with doing functions like copy and pasting text we suggest they start with a block-programming language like Scratch. @@ -32,7 +32,7 @@ Learning Python is ideal for students that have good keyboarding skills. If stu ## List of Concepts Here are some of the concepts we will be learning in this course. If you are already familiar with these concepts you can skip over some of the labs. -- **importing libraries** We need to tell Pyhton what functions we want to use. We will use the import function to tell Python which functions we need to use in our programs. +- **importing libraries** We need to tell Python what functions we want to use. We will use the import function to tell Python which functions we need to use in our programs. - **drawing** Turtle graphs has a set of drawing functions. We will learn to use these to draw patterns on the screen. - **square walk** - teach your turtle to walk in a square and draw figures. - **variables** Variables make our programs easier to read and easier to understand. @@ -41,7 +41,7 @@ Here are some of the concepts we will be learning in this course. If you are al - **functions** Functions allow us to break large programs into chunks that we can give names and can call over and over. - **function parameters** Functions can also take parameters to change the behavior of a function. - **random numbers** Random number functions allow our programs to have the computer select new random number between a range of numbers. -- **lists** Lists alow us to create collections of names. +- **lists** Lists allow us to create collections of names. - **inputs** Inputs allow us to prompt the user for values. - **recursion** Recursion allows us to have programs call themselves to create repeating patterns. - **modules** Once you have a group of related functions you can put them all together into a module. This makes it easier for others to reuse your programs. From 328345f436235a9790325563816b4b3f299876eb Mon Sep 17 00:00:00 2001 From: robertcrockett Date: Wed, 29 Jun 2022 09:01:05 -0400 Subject: [PATCH 24/28] Updated several spelling mistakes --- docs/trinket/02-simple-square.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/trinket/02-simple-square.md b/docs/trinket/02-simple-square.md index 97e63a1a..170e9f4d 100644 --- a/docs/trinket/02-simple-square.md +++ b/docs/trinket/02-simple-square.md @@ -28,11 +28,11 @@ Here is a link to the Trinket web site with this program running: [https://trinket.io/python/564899ffe9](https://trinket.io/python/564899ffe9) You can click on this link and then press the Run button. You should see the python code on the left side and the drawing on the right side of your screen. -## Explaination +## Explanation The first three lines will be the same for all our programs. They import the turtle library into our program, create a new turtle object and then assign the turtle a shape icon. Although almost all the turtle libraries work this way, there are some minor differences you will see in future examples. -## Reorinenting your turtle -Note that at the start, the turtle is facing to the right. After the last instruction, it is also facing to the right. This is a common best practice so that the turtle gets reoriented after some drawing function. If you remove the last right(90) function and run the program again you will see the turtle ends up facing upward. But if you rerun the progam you will still get the same square because the orientation of the turtle is not stored between runs. +## Reorienting your turtle +Note that at the start, the turtle is facing to the right. After the last instruction, it is also facing to the right. This is a common best practice so that the turtle gets reoriented after some drawing function. If you remove the last right(90) function and run the program again you will see the turtle ends up facing upward. But if you rerun the program you will still get the same square because the orientation of the turtle is not stored between runs. ## Experiments Can you change the distance and angle the turtle moves? What happens when you change the numbers for the forward and right functions? Can you go left as well as right? From 6dfde45eebde26c64c93a0520d5b6d884a28e135 Mon Sep 17 00:00:00 2001 From: robertcrockett Date: Wed, 29 Jun 2022 09:52:06 -0400 Subject: [PATCH 25/28] Updated to reflect octagon shape. Several typos updated as well. --- docs/trinket/04-loops.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/trinket/04-loops.md b/docs/trinket/04-loops.md index bcd3022e..61f1e745 100644 --- a/docs/trinket/04-loops.md +++ b/docs/trinket/04-loops.md @@ -28,5 +28,5 @@ dan.write('done with square') ## Experiments 1. Can you make the turtle draw a larger square? Hint: change the distance to be 80. How big can you make the square before the turtle goes off the screen? 2. Can you make a hexagon? This is a figure with six sides. Hint: the angle will need to be 60 and the range limit will need to be 6. -3. Can you make a hexagon? A Hexagon has eight sides. Hints: Try using an angle of 45. -4. Can you make a stop sign? You will need to use a dan.color('red'). a dan.begomfill() and a dan.endfill(). You can add the text of the word "stop" by using dan.moveto(x,y) and dan.write("STOP",None,None, "30pt bold"). You can also use the dan.hideturtle() so that the outline of the turtle is not displayed at the end. See: https://www.youtube.com/watch?v=HhxYt9Lskrw +3. Can you make an octagon? An Octagon has eight sides. Hints: Try using an angle of 45. +4. Can you make a stop sign? You will need to use a dan.color('red'). a dan.beginfill() and a dan.endfill(). You can add the text of the word "stop" by using dan.moveto(x,y) and dan.write("STOP",None,None, "30pt bold"). You can also use the dan.hideturtle() so that the outline of the turtle is not displayed at the end. See: https://www.youtube.com/watch?v=HhxYt9Lskrw From f21cde71afe9f55c44b0f4fc04b0699694c8cff6 Mon Sep 17 00:00:00 2001 From: robertcrockett Date: Wed, 29 Jun 2022 09:55:42 -0400 Subject: [PATCH 26/28] Used markdown to explicitly make youtube link a link --- docs/trinket/04-loops.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/trinket/04-loops.md b/docs/trinket/04-loops.md index 61f1e745..41bd796c 100644 --- a/docs/trinket/04-loops.md +++ b/docs/trinket/04-loops.md @@ -29,4 +29,4 @@ dan.write('done with square') 1. Can you make the turtle draw a larger square? Hint: change the distance to be 80. How big can you make the square before the turtle goes off the screen? 2. Can you make a hexagon? This is a figure with six sides. Hint: the angle will need to be 60 and the range limit will need to be 6. 3. Can you make an octagon? An Octagon has eight sides. Hints: Try using an angle of 45. -4. Can you make a stop sign? You will need to use a dan.color('red'). a dan.beginfill() and a dan.endfill(). You can add the text of the word "stop" by using dan.moveto(x,y) and dan.write("STOP",None,None, "30pt bold"). You can also use the dan.hideturtle() so that the outline of the turtle is not displayed at the end. See: https://www.youtube.com/watch?v=HhxYt9Lskrw +4. Can you make a stop sign? You will need to use a dan.color('red'). a dan.beginfill() and a dan.endfill(). You can add the text of the word "stop" by using dan.moveto(x,y) and dan.write("STOP",None,None, "30pt bold"). You can also use the dan.hideturtle() so that the outline of the turtle is not displayed at the end. See: [Python Stop Sign Tutorial](https://www.youtube.com/watch?v=HhxYt9Lskrw) From a081f2e0491ab211bd72bbb1d841fc9bf0897ac0 Mon Sep 17 00:00:00 2001 From: robertcrockett Date: Wed, 29 Jun 2022 10:10:49 -0400 Subject: [PATCH 27/28] Addressed python tabbing. Corrected several spelling issues. --- docs/trinket/05-conditionals.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/trinket/05-conditionals.md b/docs/trinket/05-conditionals.md index 0a316525..02c5eff8 100644 --- a/docs/trinket/05-conditionals.md +++ b/docs/trinket/05-conditionals.md @@ -10,7 +10,7 @@ Here is the basic syntax of the Python conditional operator. ```py if (i > 2): # do something if i is greater than 2 - else: +else: # do something else when i is exactly 2 or less than 2 ``` @@ -26,7 +26,7 @@ distance = 100 angle = 90 for i in range(1, 5): - # i modulo 2 is the remainer after we divide by 2 + # i modulo 2 is the remainder after we divide by 2 dan.write(i, font=("arial", 16, "normal")) if i > 2: # true if i greater than 2 dan.color('red') @@ -47,7 +47,7 @@ We would like every other side to change color. To do this we will add an if-th i % 2 ``` -In our previous loop lesson, we created an index that started at 1 and then changed to 2, 3 and finally 4. For 1 and 3, the first and third edges the result of divid by 2 will return 1 which is the same as TRUE. For 2 and 4 (the vertical sides of the square), the expression will evaluate to 0 since the remainder of 2/2 and 4/2 is zero. +In our previous loop lesson, we created an index that started at 1 and then changed to 2, 3 and finally 4. For 1 and 3, the first and third edges the result of divide by 2 will return 1 which is the same as TRUE. For 2 and 4 (the vertical sides of the square), the expression will evaluate to 0 since the remainder of 2/2 and 4/2 is zero. ```py import turtle @@ -69,7 +69,7 @@ for i in range(4): dan.write('done with square') ``` -[Conditinal Sqare](https://trinket.io/library/trinkets/5b18dc55c6) +[Conditional Square](https://trinket.io/library/trinkets/5b18dc55c6) Can you make the turtle use a larger pen size? Try dan.pensize(10) for the red and dan.pensize(3) for the blue. From 2273305674d6c860353c7d72c4a6ebd46d39e2c7 Mon Sep 17 00:00:00 2001 From: Dan McCreary Date: Thu, 3 Nov 2022 13:28:17 -0500 Subject: [PATCH 28/28] updates to markdown content --- docs/img/stop-sign.png | Bin 0 -> 9647 bytes docs/trinket/04a-stop-sign.md | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 docs/img/stop-sign.png diff --git a/docs/img/stop-sign.png b/docs/img/stop-sign.png new file mode 100644 index 0000000000000000000000000000000000000000..504458ea5cecfa6f271aeb5990c230285da3e618 GIT binary patch literal 9647 zcmaJ{Wl$W<&%fia;_iBdqQ%_{2ORERtXOd?Zij1ecXyZKE~U`oR$Pk}DR8*FJYW7F z-w)X&yP2KI?j-Y@B$2AhvY2ROXaE2JQw|DIf8~|0RELWEy4rV2bG|a5tGcWtpmu`d z@Ku3W=*n3tDFK*YWmEt#+!}!RpUEqcy%GQb$_D~KuN?T_UOvMAPAl_4|C8(fGbD~z zd$ph^m4kfH^aP$5zDXw>ZV_v>TH*()nJ1WTK=^3c(jET$OVwu?PtWAdrM@*rZ_oU6+5QcN7R2g+P@M2caK`G$-*Tsj?WMazKJc zARk5+;h>(PDWOGziiqL@QX5BPsjy$6ZG3@^9?rh`b55hjXl__O>sIAMW*%XwrmY+c zZNDhVD>w!-C`b59lP4^<$ZufZrZfWQP(Sutp-cNXc74`(7eQfg?A!{FAR^(S)}Ofl zO>5Me-q#$}hIKxy?m(Du(M2q^R|PG0&q#*g#>(d!S zR(&(ma!l9kn=$(D>p?6=wds=Bb__2Cm~Rn|zmSg&>O#_%w#E~(<0iQ}qu>7#PJgxL zSnRY)sht7xd4DS*>W@IPMzj3#B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;k;GuppR3Ov+dI@nLL5uYM*lg`n&sfjW@qFYnK+#9_O}c_LGh{nD=f$dg*C?zwOS@wkT`V*zb1iJ5jK z5(L!blItasMVaqZ+-=cU1+51kqa|t$H@$;V!=M)!G`q!3b@u+fV!Q*;&-qn_OuO;YOs7D0yAMi80yi^$fx@kqvrOq z&5mUv&2^uTj`B0eOB0WP;zOEg@&$e(EfN26t6>!Ma&u6h4GBU~{c4m{TeD!EgooiC zX)uDG6KaDDuW)~3FX@CYbVeq=Sj_zo!@$lau%%o}Xrg_)zz(sN50nTepsSkEyQEy?{xW|B4Y_45tZ+DuHzcGxAXbkH-F|9ClG8BMypQ0mscyEOKEfi z+SkUT_z}n^#8H}MH|lCH6MxQc#J?K(N_Wxp!gDW`C91T$Yw25ti@VayAz???bZh1_ z2(B?^Z}`QLefq!-k;LSruQ0C4l20KYaLW@hFokxf@Bz zgeyk9cW_IsAT$(z8#v0+fbDJUzDKrkc1A zfhxE!Sas^3fPOgvE?t>2h=9nzWWpp`aS4IIb1{`b|0Bx5`#N$7i~AWEMrcAfOf>F1 z3m(-yu`$xJbk+8;pb&zSQnwiHcD5}yxv#|%Ej~t|+B7N)|NI(#_-e1?L@)p0nHMp2 zUc~>Vi7@{EX(9qu(6mxzB3d~bC~)%?{?K&DX{iIXOlfdlaS|qkze4_59LKNHcFV-| R!+*n4a?;9>T1k_j{{wb}4^sdD literal 0 HcmV?d00001 diff --git a/docs/trinket/04a-stop-sign.md b/docs/trinket/04a-stop-sign.md index ae2f13d8..76511db6 100644 --- a/docs/trinket/04a-stop-sign.md +++ b/docs/trinket/04a-stop-sign.md @@ -1,5 +1,7 @@ # Python Turtle Graphics Stop Sign +![](../img/stop-sign.png) + In this lesson, we will use variables and for loop to draw a stop sign. We will also show how to use the penup, pendown, color, begin_fill, end_fill and write functions. Our write function will also change the font size using the ```font=("Arial", 30, "normal")``` parameter.