[Tutor] Recommended Resurce or strategy for beginning students

2019-01-22 Thread Matthew Polack
Hi All,

In our growing school we're teaching Python programming for the first time
as an elective subject with Year 9 and 10 students. (Had a dabble at this
last year with 3 students in Year 11)

I'm wondering what specific resource or stategy people would recommend for
absolute beginners?

ie. a course or program, book,...set of activities to follow that
strategically introduces and develops key skills.

At this age level I don't think we need to be achieving 'rocket
science'..but rather giving the students a good solid introduction.

Some of the leadership wanted me to use this programming in combination
with building robots...I've even wondered whether this is trying to achieve
too many things...and we're better off focused on programming itself... but
am open to this idea too...

I've had a play with using the excellent PySimpleGUI...which is an
excellent resource for building a GUI...but I've realised before doing too
much of this we might need to get a grip on core fundamentals

The challenge is trying to find a way to making this 'fun' for students
whilst also having them genuinely learn rather than just 'copying pasting'
code...achieving something that looks good...but not really understanding
what they are doing.

So far my strategy will be:

1.) Establish some core basics(utlising some form of 'course',,,which goes
through basics of syntax..variables...loops etc. utilising just raw
code...(probably a simple 'Adventure Game')
2.) Build some simple programs using PySimple GUi..eg. Some quiz games etc.
(there are some great examples on Github by another teacher and also the
author Mike of PySimpleGUI.
3.) Possibly explore robotics.

Can anyone make any recommendations on either resources or
teaching/learning strategy/curriculum.

Thank you,
Matt


Matthew Polack | Teacher


[image: Emailbanner3.png]

Trinity Drive  |  PO Box 822

Horsham Victoria 3402

p. 03 5382 2529   m. 0402456854

e. matthew.pol...@htlc.vic.edu.au

w. www.htlc.vic.edu.au

-- 
**Disclaimer: *Whilst every attempt has been made to ensure that material 
contained in this email is free from computer viruses or other defects, the 
attached files are provided, and may only be used, on the basis that the 
user assumes all responsibility for use of the material transmitted. This 
email is intended only for the use of the individual or entity named above 
and may contain information that is confidential and privileged. If you are 
not the intended recipient, please note that any dissemination, 
distribution or copying of this email is strictly prohibited. If you have 
received this email in error, please notify us immediately by return email 
or telephone +61 3 5382 2529** and destroy the original message.*
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] exporting lists into CSV issue.

2019-01-22 Thread mhysnm1964
All,

 

Thanks in advance for any assistance. This is a follow up msg from my iTunes
import issue with the xml. I have managed to successfully import the data
from the XML with Peter's and Alan's help. I have moved the information into
a list and only extracting the data I want. Now I am trying to export to a
CSV file. There is no syntax or logical errors I can see. The information is
being exported to the CSV. But when I bring it into Excel. I am getting a
blank row between each row. The exported data looks like this:

 

Name,Artist,Kind,Total Time,Year,Date Modified,Date Added,Bit Rate,Sample
Rate,Comments,Location "In Her Sights: A Montgomery Justice Novel, Book 1
(Unabridged)",Robin Perini,Audible file,25574318,2012,2015-12-12
23:48:18,2015-12-12 23:48:20,64,22050,"Jasmine 'Jazz' Parker, Jefferson
County SWAT's only female sniper, can thread the eye of a needle with a
bullet. But she carries with her a secret from her
past","file:///Volumes/Itunes/iTunes/iTunes%20Media/Audiobooks/Robin%20P
erini/In%20Her%20Sights_%20A%20Montgomery%20Justice%20Novel,%20Book%201%20(U
nabridged).aax" "Behind the Lies: A Montgomery Justice Novel, Book 2
(Unabridged)",Robin Perini,Audible file,35142797,2013,2015-12-12
23:53:33,2015-12-12 23:53:33,64,22050,"Of the six Montgomery brothers, Zach
has always walked on the wild side. He rocketed to fame playing a hero in a
movie, but off screen he's living in the shadows. Zach's dark secret: He
leads a double life as a CIA
operative",file:///Volumes/Itunes/iTunes/iTunes%20Media/Audiobooks/Robin
%20Perini/Behind%20the%20Lies_%20A%20Montgomery%20Justice%20Novel,%20Book%20
2%20(Unabridged).aax

 

I would have expected a new line between each book, but there is a space.
The code looks like this:

 

import plistlib, pprint, csv 

 

with open("library.xml", "rb") as f:

data = plistlib.load(f)

 

books =[['Name', 'Artist', 'Kind', 'Total Time', 'Year', 'Date Modified',
'Date Added', 'Bit Rate', 'Sample Rate', 'Comments', 'Location']]

 

for book in list(data['Tracks'].values()):

tmp = []

if not 'Audible file' in book['Kind']:

break # skip book

for key in books[0]:

if key in book:

tmp.append(book[key])

else:

tmp.append("")

books.append(tmp)

 

with open ('books-list.csv', 'w') as wf:

writer = csv.writer(wf)

writer.writerows(books)

wf.close()

 

When I debug the above. The output of books look fine to me. For example:

 

(Pdb)
['Name', 'Artist', 'Kind', 'Total Time', 'Year', 'Date Modified', 'Date
Added', 'Bit Rate', 'Sample Rate', 'Comments', '
Location']
(Pdb)
(Pdb) books[0] 
]
0
['In Her Sights: A Montgomery Justice Novel, Book 1 (Unabridged)', 'Robin
Perini', 'Audible file', 25574318, 2012, datet
ime.datetime(2015, 12, 12, 23, 48, 18), datetime.datetime(2015, 12, 12, 23,
48, 20), 64, 22050, "Jasmine 'Jazz' Parker,
Jefferson County SWAT's only female sniper, can thread the eye of a needle
with a bullet. But she carries with her a sec
ret from her past",
'file:///Volumes/Itunes/iTunes/iTunes%20Media/Audiobooks/Robin%20Perini/In%2
0Her%20Sights_%20A%2
0Montgomery%20Justice%20Novel,%20Book%201%20(Unabridged).aax']
(Pdb)
(Pdb) books[1] 
]
1
['Behind the Lies: A Montgomery Justice Novel, Book 2 (Unabridged)', 'Robin
Perini', 'Audible file', 35142797, 2013, dat
etime.datetime(2015, 12, 12, 23, 53, 33), datetime.datetime(2015, 12, 12,
23, 53, 33), 64, 22050, 'Of the six Montgomery
brothers, Zach has always walked on the wild side. He rocketed to fame
playing a hero in a movie, but off screen he's l
iving in the shadows. Zach's dark secret: He leads a double life as a CIA
operative', 'file:///Volumes/Itunes/iTunes
/iTunes%20Media/Audiobooks/Robin%20Perini/Behind%20the%20Lies_%20A%20Montgom
ery%20Justice%20Novel,%20Book%202%20(Unabrid
ged).aax']
(Pdb)

 

Any ideas why this could be occurring? 

 

Regards

Sean 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Resurce or strategy for beginning students

2019-01-22 Thread Alan Gauld via Tutor
On 22/01/2019 06:57, Matthew Polack wrote:

> In our growing school we're teaching Python programming for the first time
> as an elective subject with Year 9 and 10 students. (Had a dabble at this
> last year with 3 students in Year 11)
> 
> I'm wondering what specific resource or stategy people would recommend for
> absolute beginners?

There is a beginners page on the Python web site for non
programmers. It lists many tutorials that you could consider.

Also there used to be an Education Special Interest Group
(edu-sig) populated with teachers using Python in schools.
I don't know if it is still active but you could try asking there.

I do know that at least two schools have used my tutorial(see .sig).
One of them for a class of 14 year olds (I have no idea what age
range your year 9/10 students are). It is intended to teach good
programming theory as well as practice.

Another more academic tutorial is Allan Downey's "Think Python"
site. It is slightly deeper than mine but covers less breadth.

> Some of the leadership wanted me to use this programming in combination
> with building robots...I've even wondered whether this is trying to achieve
> too many things...and we're better off focused on programming itself... but
> am open to this idea too...

In the UK many schools use the RaspberryPi project to teach robots to
kids as part of their Technology courses. The programming is picked up
by osmosis on an as-needed basis. The upside is that it's a lot of fun
and gets kids used to the concepts of hardware and software working in
unison. The downside is that they learn a lot of bad coding habits and
don't understand the theoretical underpinnings of either the hardware or
software. But as a way to get them hooked it works well .

> I've had a play with using the excellent PySimpleGUI...which is an
> excellent resource for building a GUI...but I've realised before doing too
> much of this we might need to get a grip on core fundamentals

The turtle module is good too. Turtle graphics were invented
explicitly to teach kids programming (using the LOGO programming
language). They are even better when combined with a real robot
turtle, but I'm not sure how you would do that using Python.
There may be an off the shelf option if you Google it...

> 1.) Establish some core basics(utlising some form of 'course',,,which goes
> through basics of syntax..variables...loops etc. utilising just raw
> code...(probably a simple 'Adventure Game')

Don't underestimate the power of CLI when starting out.
Classic games like oxo, hangman and Conway's life are challenging
for beginners and easy to do on a terminal. (They are also great for
demonstrating how good data structure design can radically simplify
complex code.)

Adventure games like the Colossal Cave are obviously easy on
a CLI too.

> 2.) Build some simple programs using PySimple GUi..eg. Some quiz games etc.
> (there are some great examples on Github by another teacher and also the
> author Mike of PySimpleGUI.

Consider including basic GUIs too. They are the simplest way
to get them into event driven thinking and for some types
of programming are easier to write than CLI apps. The only
snag with Python is the lack of a GUI builder which forces
the kids to write a lots of boring boiler plate code...

> 3.) Possibly explore robotics.

Or web programming maybe? There are lots of easy Web frameworks
for Python and since, for most kids today, computing *is* the
web it might be worthwhile. The downside is it introduces
a lot of new concepts - HTML, networks etc


Overall it sounds good.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] exporting lists into CSV issue.

2019-01-22 Thread Alan Gauld via Tutor
On 22/01/2019 09:25, mhysnm1...@gmail.com wrote:

> being exported to the CSV. But when I bring it into Excel. I am getting a
> blank row between each row. The exported data looks like this:

I can't see anything obvious.

> import plistlib, pprint, csv 
> 
> with open("library.xml", "rb") as f:
> data = plistlib.load(f)
> 
> books =[['Name', 'Artist', 'Kind', 'Total Time', 'Year', 'Date Modified',
> 'Date Added', 'Bit Rate', 'Sample Rate', 'Comments', 'Location']]
> 
> for book in list(data['Tracks'].values()):

You don't need to convert to list.
You can just iterate over the values().
I don't think that should add any newlines but it
might be worth removing the list to see.


> 
> tmp = []
> if not 'Audible file' in book['Kind']:
> break # skip book
> for key in books[0]:
> if key in book:
> tmp.append(book[key])
> else:
> tmp.append("")
> books.append(tmp
> 
> with open ('books-list.csv', 'w') as wf:
> writer = csv.writer(wf)
> writer.writerows(books)

You could try writing(and printing) the rows individually:
 for row in books:
   # print(row)  # debugging only
   writer.writerow(row)

To see if it is writerows() that is adding the spurious lines.
If that's the case there may be a parameter to change
or suppress the separator.

It might also be easier to use the csv.dictwriter
since your data appears to be in the form of a dict
to start with. Although I'm not sure how dictwriter
copes with missing fields.

> wf.close()

Don't use close() if you are using "with open..."
Closing is done automatically. It's one of the
advantages of the 'with' style.

hth
-- 
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] exporting lists into CSV issue.

2019-01-22 Thread Peter Otten
mhysnm1...@gmail.com wrote:

> Now I am
> trying to export to a CSV file. There is no syntax or logical errors I can
> see. The information is being exported to the CSV. But when I bring it
> into Excel. I am getting a blank row between each row.

> with open ('books-list.csv', 'w') as wf:

Try switching off newline conversion:

with open('books-list.csv', 'w', newline="") as wf:
   ...

The csv.writer() delimits records with "\r\n", and on Windows open() 
converts "\n" to "\r\n" by default. Therefore you probably (no Window handy 
to to confirm) end up with "\r\r\n" between the rows.

See also .

> writer = csv.writer(wf)
> writer.writerows(books)

At this point the file is already closed by the context manager, no need for 
an extra

> wf.close()


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] exporting lists into CSV issue.

2019-01-22 Thread mhysnm1964
All,

 

I have addressed the issue. When I open the file, I am using newline='' as
one of the parameters. 

 

with open ('books-list.csv', 'w', newline='', encode='utf-8') as wf:

 

I added the UTF-8 as I discovered after sending my original email I was not
importing all the books. I discovered I was getting an utf-8 error due to
some of the content. Now I have all my books in a spreadsheet. Stage 2, is
to cross reference all this information against my audible library which I
will have to extract.

 

All this is to learn the different methods of extracting data.

 

 

From: mhysnm1...@gmail.com  
Sent: Tuesday, 22 January 2019 8:26 PM
To: tutor@python.org
Subject: exporting lists into CSV issue.

 

All,

 

Thanks in advance for any assistance. This is a follow up msg from my iTunes
import issue with the xml. I have managed to successfully import the data
from the XML with Peter's and Alan's help. I have moved the information into
a list and only extracting the data I want. Now I am trying to export to a
CSV file. There is no syntax or logical errors I can see. The information is
being exported to the CSV. But when I bring it into Excel. I am getting a
blank row between each row. The exported data looks like this:

 

Name,Artist,Kind,Total Time,Year,Date Modified,Date Added,Bit Rate,Sample
Rate,Comments,Location "In Her Sights: A Montgomery Justice Novel, Book 1
(Unabridged)",Robin Perini,Audible file,25574318,2012,2015-12-12
23:48:18,2015-12-12 23:48:20,64,22050,"Jasmine 'Jazz' Parker, Jefferson
County SWAT's only female sniper, can thread the eye of a needle with a
bullet. But she carries with her a secret from her
past","file:///Volumes/Itunes/iTunes/iTunes%20Media/Audiobooks/Robin%20P
erini/In%20Her%20Sights_%20A%20Montgomery%20Justice%20Novel,%20Book%201%20(U
nabridged).aax" "Behind the Lies: A Montgomery Justice Novel, Book 2
(Unabridged)",Robin Perini,Audible file,35142797,2013,2015-12-12
23:53:33,2015-12-12 23:53:33,64,22050,"Of the six Montgomery brothers, Zach
has always walked on the wild side. He rocketed to fame playing a hero in a
movie, but off screen he's living in the shadows. Zach's dark secret: He
leads a double life as a CIA
operative",file:///Volumes/Itunes/iTunes/iTunes%20Media/Audiobooks/Robin
%20Perini/Behind%20the%20Lies_%20A%20Montgomery%20Justice%20Novel,%20Book%20
2%20(Unabridged).aax

 

I would have expected a new line between each book, but there is a space.
The code looks like this:

 

import plistlib, pprint, csv 

 

with open("library.xml", "rb") as f:

data = plistlib.load(f)

 

books =[['Name', 'Artist', 'Kind', 'Total Time', 'Year', 'Date Modified',
'Date Added', 'Bit Rate', 'Sample Rate', 'Comments', 'Location']]

 

for book in list(data['Tracks'].values()):

tmp = []

if not 'Audible file' in book['Kind']:

break # skip book

for key in books[0]:

if key in book:

tmp.append(book[key])

else:

tmp.append("")

books.append(tmp)

 

with open ('books-list.csv', 'w') as wf:

writer = csv.writer(wf)

writer.writerows(books)

wf.close()

 

When I debug the above. The output of books look fine to me. For example:

 

(Pdb)
['Name', 'Artist', 'Kind', 'Total Time', 'Year', 'Date Modified', 'Date
Added', 'Bit Rate', 'Sample Rate', 'Comments', '
Location']
(Pdb)
(Pdb) books[0] 
]
0
['In Her Sights: A Montgomery Justice Novel, Book 1 (Unabridged)', 'Robin
Perini', 'Audible file', 25574318, 2012, datet
ime.datetime(2015, 12, 12, 23, 48, 18), datetime.datetime(2015, 12, 12, 23,
48, 20), 64, 22050, "Jasmine 'Jazz' Parker,
Jefferson County SWAT's only female sniper, can thread the eye of a needle
with a bullet. But she carries with her a sec
ret from her past",
'file:///Volumes/Itunes/iTunes/iTunes%20Media/Audiobooks/Robin%20Perini/In%2
0Her%20Sights_%20A%2
0Montgomery%20Justice%20Novel,%20Book%201%20(Unabridged).aax']
(Pdb)
(Pdb) books[1] 
]
1
['Behind the Lies: A Montgomery Justice Novel, Book 2 (Unabridged)', 'Robin
Perini', 'Audible file', 35142797, 2013, dat
etime.datetime(2015, 12, 12, 23, 53, 33), datetime.datetime(2015, 12, 12,
23, 53, 33), 64, 22050, 'Of the six Montgomery
brothers, Zach has always walked on the wild side. He rocketed to fame
playing a hero in a movie, but off screen he's l
iving in the shadows. Zach's dark secret: He leads a double life as a CIA
operative', 'file:///Volumes/Itunes/iTunes
/iTunes%20Media/Audiobooks/Robin%20Perini/Behind%20the%20Lies_%20A%20Montgom
ery%20Justice%20Novel,%20Book%202%20(Unabrid
ged).aax']
(Pdb)

 

Any ideas why this could be occurring? 

 

Regards

Sean 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Resurce or strategy for beginning students

2019-01-22 Thread Mike Barnett
I like the idea of starting out right away on a GUI.  I know this is completely 
backwards to what would normally be taught, but hear me out.  Kids today are 
used to GUI interfaces.  They're on their phones, their computers, their TV  
sets.  

Why not teach kids to output to a window instead of a command line?  What if 
it's just was easy, or easier, to work with a GUI as it is the command line?

To output to the command line in standard Python:
print('my string', variable1, variable2)

To output the same information to a window using PySimpleGUI:
Popup('my string', variable1, variable2)

Or, you can "print" to a debug window if that's your thing.
Print('takes the same parameters as print')

If the ultimate goal is to teach kids about how to design a GUI window, how to 
lay out a GUI using good user interface design principals, then it would be 
nice to get the GUI coding out of the way and let the focus instead be on the 
GUI itself.  This is when having a drag-and-drop Designer Tool is handy.  If 
not, then the next best thing is a simple programming interface.

PySimpleGUI was designed so that the code visually matches the window layout.  

It's capable of duplicating pretty much any layout and widget combination that 
you can create coding directly to tkinter's (or Qt's or WxPython's) interfaces. 
 PySimpleGUI simply creates and executes the "boilerplate" code that is often 
brought up when GUIs are discussed.  

A goal was to remove all of the boilerplate code and provide a programmer with 
a simple, friendly and flexible set of APIs.  You write a single line of code 
per row of widgets in your window plus a 1/2 dozen lines to implement the event 
loop.

I don't see the harm in approaching the problem from a different direction.  It 
could be wildly successful.  Or... not...  The worst that can happen is you 
screw up a classroom full of future programmers, creating a warped vision that 
GUIs can be fun and easy.


@mike

-Original Message-
From: Matthew Polack  
Sent: Tuesday, January 22, 2019 1:58 AM
To: tutor@python.org
Subject: [Tutor] Recommended Resurce or strategy for beginning students

Hi All,

In our growing school we're teaching Python programming for the first time as 
an elective subject with Year 9 and 10 students. (Had a dabble at this last 
year with 3 students in Year 11)

I'm wondering what specific resource or stategy people would recommend for 
absolute beginners?

ie. a course or program, book,...set of activities to follow that strategically 
introduces and develops key skills.

At this age level I don't think we need to be achieving 'rocket science'..but 
rather giving the students a good solid introduction.

Some of the leadership wanted me to use this programming in combination with 
building robots...I've even wondered whether this is trying to achieve too many 
things...and we're better off focused on programming itself... but am open to 
this idea too...

I've had a play with using the excellent PySimpleGUI...which is an excellent 
resource for building a GUI...but I've realised before doing too much of this 
we might need to get a grip on core fundamentals

The challenge is trying to find a way to making this 'fun' for students whilst 
also having them genuinely learn rather than just 'copying pasting'
code...achieving something that looks good...but not really understanding what 
they are doing.

So far my strategy will be:

1.) Establish some core basics(utlising some form of 'course',,,which goes 
through basics of syntax..variables...loops etc. utilising just raw 
code...(probably a simple 'Adventure Game')
2.) Build some simple programs using PySimple GUi..eg. Some quiz games etc.
(there are some great examples on Github by another teacher and also the author 
Mike of PySimpleGUI.
3.) Possibly explore robotics.

Can anyone make any recommendations on either resources or teaching/learning 
strategy/curriculum.

Thank you,
Matt


Matthew Polack | Teacher


[image: Emailbanner3.png]

Trinity Drive  |  PO Box 822

Horsham Victoria 3402

p. 03 5382 2529   m. 0402456854

e. matthew.pol...@htlc.vic.edu.au

w. www.htlc.vic.edu.au

--
**Disclaimer: *Whilst every attempt has been made to ensure that material 
contained in this email is free from computer viruses or other defects, the 
attached files are provided, and may only be used, on the basis that the user 
assumes all responsibility for use of the material transmitted. This email is 
intended only for the use of the individual or entity named above and may 
contain information that is confidential and privileged. If you are not the 
intended recipient, please note that any dissemination, distribution or copying 
of this email is strictly prohibited. If you have received this email in error, 
please notify us immediately by return email or telephone +61 3 5382 2529** and 
destroy the original message.*

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or chang

[Tutor] Recommended Resurce or strategy for beginning students, (Matthew Polack)

2019-01-22 Thread Scott Larsen




3. Recommended Resurce or strategy for beginning students
   (Matthew Polack)

Matt,
    I don't have any specific recommendations other than to make sure 
you were aware of a podcast I recently stumbled across called Teaching 
Python by Sean Tibor and Kelly Paredes.  I've only listened to one 
episode but it sounds as though she's a teacher and he's a programmer 
and they're working together to do something similar to what you're 
taking on.


https://itunes.apple.com/us/podcast/teaching-python/id1445806053?mt=2

Best of luck,
Scott
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor