Schedule

Schedule

Wednesday, May 27

1432740600 FLOSS Weekly
1432746000 Tech News Today
1432749600 Windows Weekly
1432756800 This Week in Google
1432767600 Tech News 2Night
1432769400 Android App Arena
1432774800 Ham Nation

Thursday, May 28

1432827000 Tech News Today
1432830600 TWiT Live Specials
1432839600 Know How...
1432846800 Home Theater Geeks
1432854000 Tech News 2Night

Friday, May 29

1432918800 Tech News Today
1432922400 This Week in Law
1432933200 Before You Buy
1432940400 Tech News 2Night

Saturday, May 30

1433008800 The Tech Guy

Sunday, May 31

1433095200 The Tech Guy
1433109600 This Week in Tech

Monday, June 1

1433178000 Tech News Today
1433181600 Triangulation
1433187000 iOS Today
1433194200 Coding 101
1433199600 Tech News 2Night

Tuesday, June 2

1433264400 Tech News Today
1433268000 MacBreak Weekly
1433277000 Security Now
1433286000 Tech News 2Night
1433289600 All About Android

Wednesday, June 3

1433345400 FLOSS Weekly
1433350800 Tech News Today
1433354400 Windows Weekly
1433361600 This Week in Google
1433372400 Tech News 2Night
1433374200 Android App Arena
1433379600 Ham Nation

Thursday, June 4

1433437200 Tech News Today
1433440800 Know How...
1433451600 Home Theater Geeks
1433458800 Tech News 2Night

Friday, June 5

1433523600 Tech News Today
1433527200 This Week in Law
1433538000 Before You Buy
1433545200 Tech News 2Night

Most Recent Episodes

All About Android

Google IO predictions, Periscope for Android, and a a packed round table session.

Security Now
Episode #509: TLS Logjam May 26th, 2015

Routers with a USB port could be vulnerable to attack because of a NetUSB bug.

Tech News 2Night

Mashable's Jason Abbruzzese talks Charter/TWC merger

MacBreak Weekly

Jony Ive promoted to 'Chief Design Officer'

Tech News Today

Jony Ive has been promoted to Apple's Chief Design Officer.

This Week in Tech

Uses of VR, Key FOB security, new Spotify, @POTUS, and more.

The Tech Guy
The Tech Guy 1190 May 24th, 2015

Make your own media player.

The New Screen Savers

Delighting audiences for decades, our guest Martin Sargent

The Tech Guy
The Tech Guy 1189 May 23rd, 2015

Finding a low cost telephone line that works during power outages.

This Week in Enterprise Tech

Your SSDs are DOOMED!

Coding 101 17

Python: Tuples

May 15 2014

Hosts: Fr. Robert Ballecer, SJ and Shannon Morse

Guest: Dale Chase

Welcome to Coding 101 - It's the TWiT show that gives YOU the knowledge to live in the wonderful world of the programmer. This week we are introducing our newest module, Python with Code Warrior Dale Chase!

To see all the code used in today's episode, go to Our Github Repository for Module 2

Printing Everything within a List:

The way we've been printing lists is to use a "for loop" to print everything within the list:

podcasters = ['Leo','Lisa','Padre', 'Snubs', 'Bryan', 'OMGchad']

for entries in range (0,6):

- print podcasters[entries]

* This will print each individual entry on its own line.

If we JUST wanted to know the contents of the list:

mylist = [142, 512, 'dog', 'cat', 'bird', 123]

print mylist

* This will print EVERYTHING that is in the list "mylist" - including the comas, spaces and brackets

Sorting the List

-- We've been using "destructive sorting" with the "list.sort()" function
-- When we use "sort()" on a list, we sort "IN PLACE" which destroys the original list

SortMe = [1, 23, 6, 4, 99]

for entries in range (0,5):

- print SortMe[entries]

raw_input ("Press Enter")

SortMe.sort();

for entries in range (0,5):

- print SortMe[entries]
"

NON-DESTRUCTIVE SORTING
-- We can do a non-destructive sorting of a list.
-- It keep the original list while sorting the data.

podcasters = ['Leo','Lisa','Padre', 'Snubs', 'Bryan', 'OMGchad', 1234]

print podcasters

print "Woot, let's sort!"

sortedpodcasters = sorted(podcasters)

raw_input(""Press Enter to Continue"")

print podcasters

print sortedpodcasters
"

We can ALSO sort WITHOUT creating a new list

podcasters = ['Leo','Lisa','Padre', 'Snubs', 'Bryan', 'OMGchad', 1234]

print sorted(podcasters)
"

Tuples

* Tuples work like lists, but they are immutable. They cannot be changed.
- They use parentheses instead of brackets
- You can have a list of tuples.

twit_tuples = [

('Padre', 'TWiET', 72),
('Snubs', 'C101', 22),
('Bryan', 'KnowHow', 6),

]

print twit_tuples
"

Sorting Tuples

twit_tuples = [

('Padre', 'TWiET', 72),
('Snubs', 'C101', 22),
('Bryan', 'KnowHow', 6),

]

print sorted(twit_tuples, key=lambda twit: twit[2])

Get in Touch With Us!

* Subscribe and get Coding 101 automatically at TWiT.tv!
* Follow PadreSJ and Snubs on Twitter.
* Watch the show live and join the chatroom every Thursday at 1:30pm PST.
* Email us at Padre@twit.tv and Shannon@twit.tv.
* Join our Google+ Community!
Download or subscribe to this show at twit.tv/code. Also, check out our transcripts.

Bandwidth for Coding 101 is provided by Cachefly.

Running time: 53:01