Mary Dickson Diaz

Code, Life, Learning

Tag: python (page 2 of 2)

MITx review

Hey readers,

Our move is this Friday, and my next Code Fellows class starts up the following Monday. So, I am calling last week and this week “spring break” for sanity’s sake. Back with more content next week if not sooner!

Meanwhile, I’m wrapping up “Introduction to Computer Science and Programming Using Python,” a MOOC that comes to a close on Tuesday after nine weeks. Even with some serious slacking/re-prioritization the last few weeks, I’ll complete the class with at least a 57%, which is a passing “C” grade. With a bit of effort into the final exam, I’m hoping to hit 65% for a “B.” And a great thing is that you get to keep access to the course after it ends, so I’ll be able to catch up on what I missed eventually (after all, this is about the learning and not the grade).

Continue reading

changing environments

What a week!

Personal update: Josh and I signed a mountain of paperwork yesterday and are just waiting… waiting… for JUST GOT final notification that we’ve closed on a house here in Seattle. This process has been nail-biting right up until very end. I sold my house in Houston back in October and we were outbid on a house in Seattle earlier this winter. That turned out to be a blessing because it enabled me to leave my job and for us to still qualify for a (smaller) loan on Josh’s income alone. All in all, we’ll be paying half as much each month on our mortgage as we’re currently paying in rent, and moving from a land of faceless high-rise condos to a wonderfully diverse neighborhood with an invested community. Anyway, the house buying process is a lot different from 2010, when I bought my house in Houston. More paperwork, more disclosures, and more “we’re all set just waiting on this oooooone little make-or-break thing….” It may sounds nuts but trust me that rent here is no joke, and *buying a house* is going to *save us money* in both the short and long-term. Crazy, I know.

So, that’s been taking up a lot of my time and mental energy. But we’re excited!!

No new work to share… but elsewhere online, here’s some stuff I’m paying attention to: Continue reading

complexity rules everything around me

Hey Wu-team, Mary here, checking in from the Fields of Distractionville. I spent like three whole days this week dreaming of Greek island sunsets and planning an international trip that may or may not come to fruition. I’d be lying if I didn’t share that I’m feeling a bit deterred. Thus, I  don’t have anything new to share this week except for this music video and some hard truths. (Java-javaScript, y’all.)

HARD TRUTH #1: Recursive algorithms: you have to learn them.

Colin is a bad-ass programmer and when I questioned the relevance of this Python McNugget quiz question he shot down my hope that the question was an outlier. You can google for more, and here is Colin’s proof that 43 is the highest possible “non-McNugget number,” if you are interested: click me for McProof.

In a nutshell, recursive algorithms look like this:

def recurPower(base, exp): //this defines a function 'recurPower' that takes in two numbers and returns base^exp
 if exp == 0:
   return 1
 elif exp == 1:
   return base
 else:
   return base * recurPower(base, exp-1)

It’s tricky to conceptualize the idea of using a function *while defining that function* but that’s how recursive algorithms work. This one is about the simplest they get, it’s all downhill from here.

HARD TRUTH #2: Programing == Math.

I will admit to purposefully not turning in this week’s Python assignment about looking at programs and analyzing them for efficiency and efficiency’s opposite, complexity. An example is: how many steps will it take the computer to execute this program? And while it would be lovely to be able to answer “1” or “42,” the answer is usually something more like “5log2(n)+2008.”

Complexity impacts run-time and memory usage, all stuff that programmers need to care about, I suppose. Conceptually, I can understand that a more efficient program is going to mean the difference between your lightning fast web application beating out the slower competition. But as I’m still learning, I skimmed over this lesson thinking: “This is advanced math stuff and it’s tripping me up. I’ll skip this for now. I need to get programs consistently running first, and then I’ll worry about how efficient they are.”

And then look what pops up in the latest Code Fellows lesson:

 

Yeeeah. Hello, complexity. And do you see that lovely red bar of lowest complexity… what does that say? That’s a log function, friends. That’s MATH.

So, ok. Not to worry. One step at a time. The last hard truth is personal to me, but here it is:

HARD TRUTH #3: Do not go gentle down that web development path.

I’ve been wavering a bit on the best course of action for me going forward. After reflection, I think I want to pursue further study in Python with an eye to data science and analytics, what is sometimes referred to as “back-end” programming (systems focused) as opposed to web development which is “front-end” (user focused).  The good news is that Code Fellows has a pathway to making this happen. The bad news is that it’s hard. Like, really hard. And full of math. There is less precedence, programs, and guidance for this path than if I were to pursue web development, and I’ll still have to learn JavaScript to be employable, and I’m ok with that.

So, what now?

Make programs. Get them working. Get registered for the Foundations II Python Course. Make more programs. Make websites. Look at job descriptions and figure out what jobs/skills are connected to programming with Python (learn git), learn those skills and find people in those jobs.

…And plan the honeymoon, because that’s important too. 😀

Programmers: what hard truths did you learn early (or late) in your careers? Share ’em in the comments!

 

quiz day

Python quiz commences:

 

Eight hours later:

 

finishing the bot

finishing the bot
how you have to finish the bot…
how you watch the rest of the world from a window–
while you finish the bot

mapping out a .py
what you feel for twitter’s API
what you feel when errors that come through heroku go

“tweet status update failed on third try…”

I have been watching Stephen Sondheim musicals basically non-stop and this song seems most appropriate for the past few days. “Oh there’s a new lecture out…. BOT.” “I should get started on that javascript pre-work…. BOTBOTBOT.” “It’s 2:30 in the morning…. BOOOOOOOTTTT”

twitterscreenshot

My bot is now deployed and fully-functioning out in The Cloud, thanks to Joel!

>>Ok I have a twitter bot and I want to run it but not from my personal computer, help

The above link tells the story of how I went from here (functioning bot, living on my laptop) to here (functioning bot, living on GitHub/running on heroku). First, you’ll need to install heroku and follow the directions to get started, here. After that, follow Joel’s directions and you’re golden.

I hope you didn’t have other things to do today.

UPDATE 6/25/15

This is part 2 of the tutorial.

Part 1: Build a Twitter Bot with Python

Part 3: Top Bot

build a twitter bot with python

This year I set out to learn how to make twitter bots, accounts that automatically interact with twitter in some way, whether through tweeting set content at regular intervals, watching for and responding to code words, or responding in a certain way when tweeted at. I learned the basics of Twitter API interaction at UW’s Community Data Science Workshop last November, and have since been inspired by other people doing cool stuff with bots.

Witness:

For more great examples, check out 52bot project.

A few nights ago, as I was reading about the reunion of the women of Bletchley Park, I clicked through to the Honour Roll and found a database that looked like it might translate well into a twitterbot. Using a subset of data and some internet tutorials, a test bot took maybe an hour or two tops to set up (and I was so thrilled when it worked!). The time-consuming part has been 1) finding a way to reliably keep it tweeting; and 2) pulling and cleaning up the full dataset to fit twitter’s 140 character limit (in my test run, I just told twitter “print the first 140 characters and ignore the rest” but for the full deployment, I wanted to edit the longer bios to make them fit).

Ok, so without further ado, here’s the bot:

And here’s how I made it!: Continue reading

f.read()

Bletchley Park Commemorative Badge

Bookmarked this week:

  1. Emotional reunion after 70 years for Bletchley Park veterans – I haven’t seen Imitation Game yet, but I did watch (and enjoy) Bletchley Circle. So inspiring to see the real Wrens here reunited and as sharp as ever. Click through the image above to peek at the Roll of Honour. (Also, that looks like it might make a great Twitterbot project… hmmm…)
  2. Retiring Python as a Teaching Language — James Hague makes a case for learning JavaScript first. I can commiserate with the sentiment of “but what can I doooo with Python” — I’m trying to figure out a way to get my neat-o credit card program onto this webpage in an interactive format. I started playing around with django, which I think will let me do that? But there could probably be an easier way.
  3. 10 things you need to know before applying to a code school — and if you’re in Seattle, you might want to attend “A glimpse into disruptive web development education” next Tuesday evening, with representatives from General Assembly, Code Fellows, and Ada Developers Academy, including instructors, students, and business development partners from the hiring side, discussing their respective education models.” It’s like they planned it *for me*. Do not miss!
  4. Programing doesn’t belong to men (it belongs to me) – by Julia Evans. Get it, girl.

question set 2: things get interest-ing

First, an update on the MIT Python course — y’all, my MOM is taking it too. How cool is that? Mom has a full career behind her in computer programming, technical writing and online learning, and she’s also Mensan-level puzzler, so naturally she is 1) kicking my ass and 2) taking issue with some of the courseware issues (and by extension, other people in the class).

I agree that the “discussion” aspects of the class are not great, something like 1,000+ 50,000+ people are enrolled so it’s best to take the comments with a grain of salt, and find some support that you trust. Quick aside, the guy who was like: “What is paying off credit card debt?? I do not understand this concept” — maybe has never known debt or has never known credit cards, or just didn’t understand how the question was worded? Anyway it made me chuckle.

So, this MOOC format probably doesn’t take advantage of best practices for online learning. But it’s free and exposing lots of people to something new, so I suppose you get what you pay for. I’d still recommend the class, just not as a stand-alone or a substitution for a full-on college degree (I have one already).

Ok, back to problem set 2 — paying off credit card debt. I am exceptionally proud that I completed all the programs in this set totally by myself, and for something more useful than “find ‘beeeegh.'” SO PROUD in fact that I failed to read the directions and wrote an entirely different program from the one they asked for. My friend Ian commiserates:

Continue reading

“and the greatest of these is z”


Photo credit: DuBoix from morguefile.com

Whaddup, Python people. My first homework assignment for MIT’s Introduction to Computer Science and Programming Using Python was due today, testing our knowledge of simple algorithms (“for” and “while” loops). Spoiler: it was hard, and I cried. Also, Python has a funny way of ranking the English alphabet.

The first two homework questions were similar to problems I have encountered before:

1. Given a string of letters, count the vowels (assume all are lowercase). Here’s one answer:

Continue reading

Newer posts »

© 2019 Mary Dickson Diaz

Theme by Anders NorenUp ↑