• Home
  • Blog
  • Data Science Portfolio
  • Language Coaching
  • RSS
  • First Draft Publishing
  • Sources & Methods
  • About
  • Blog Archive
  • My Work
  • Contact
  • Menu

A Different Place

  • Home
  • Blog
  • Data Science Portfolio
  • Language Coaching
  • RSS
  • First Draft Publishing
  • Sources & Methods
  • About
  • Blog Archive
  • My Work
  • Contact

Dinner Party Decision Matrix: A Python Tool

December 29, 2016 in Coding, Useful Tools

Some friends were coming round for dinner this evening and I couldn’t decide what to cook. I couldn’t decide because there were too many variables floating around that would impact the decision.

So I decided to make an app.

I wanted something tasty but that also was relatively hassle-free. I wanted something that didn’t take too much time to prepare, but it still needed to be different from the kind of food I’d cook in a rush at the end of a long day.

I’d come across the idea of weighted decision-making a while back, and really like its premise; you say how important various factors are to you and then rate all the different options according to those same factors. At the end, you’re left with a score that can be said to be more objective than just your gut feeling.

So yesterday morning I listed a bunch of the factors that were important to me in coming to a decision about what to cook. I figured I could get some coding practice by making a tool that would work to calculate the best option from any combination of choices.

I put the finishing touches on the decision-making tool this morning. You can check it out on Github, though you’ll need to know a little about how Python works to get it going for yourself. I’m fairly sure my code looks horrific to a seasoned professional. There are probably ways I could have standardised the flow of questions and improved the output, but for now, I’m satisfied.

The app ended up picking the following for dinner (photo below):

- Courgette, chickpea and feta filo pastry pie

- Roast beetroot and pistachio salad

- Kale, pomegranate and shredded chicken salad

- and a beetroot and chocolate cake

dinner.png

I learnt a bunch of things about Python while coding the tool:

  1. When you run a x= raw_input(“Ask question here”) command, the information allocated to x will be in a string format. If you are collecting numbers, you’ll need to convert it to an integer format by using int().
  2. Lists and dictionaries can be tricky, particularly when you’re looping over them or looping over certain keys etc.
  3. It helps to test while you code. This particular function wasn’t too complex to understand, so I just pushed on without testing so much. At some point towards the end, I realised something in the middle was wrong: cue much debugging. I keep reading about the importance of having in-built tests. I’m not sure what that would mean / have meant in the context of this particular app, but I imagine I’ll find out in due course.
  4. Coding is fun and appeals to the compulsive side of my brain. I rarely need to be urged back to the task at hand when I’m coding. This probably has something to do with the quick feedback loop that coding enables. In any case, I’m hooked (again).
Tags: food, python, coding, tools
Prev / Next

Mailing List

Popular Posts

Featured
Coding, Productivity
Solid Study Habits for Coders
Coding, Productivity
Coding, Productivity
General, Movement
Pain: A Love Story
General, Movement
General, Movement
Useful Tools, Productivity, Tech, Language, Coding
Introducing CoachBot: Your Personal Language Taskmaster
Useful Tools, Productivity, Tech, Language, Coding
Useful Tools, Productivity, Tech, Language, Coding
Books, Jordan, Language
Everything You Need to Study Jordanian Arabic
Books, Jordan, Language
Books, Jordan, Language
Incremental Elephant, Language, Books
The Two Books Every Intermediate Arabic Student Needs to Read
Incremental Elephant, Language, Books
Incremental Elephant, Language, Books
Books, Productivity
Fundamentals Versus Hacks
Books, Productivity
Books, Productivity
Productivity, PhD
PhD Tools: The Secret to Finishing Your PhD
Productivity, PhD
Productivity, PhD
Jordan, Climbing
Existential Battles: Climbing in Amman
Jordan, Climbing
Jordan, Climbing
Afghanistan, Books, First Draft Publishing
Reading the Afghan Taliban: 67 Sources You Should Be Studying
Afghanistan, Books, First Draft Publishing
Afghanistan, Books, First Draft Publishing
Books, Journalism, Pakistan
North Waziristan: A Reading List
Books, Journalism, Pakistan
Books, Journalism, Pakistan

Recent Posts

Blog
Solid Study Habits for Coders
about 11 hours ago
Using Ruby's .zip method to combine arrays
about 3 days ago
Pain: A Love Story
about 2 weeks ago
RaspberryLPIC: A New Series & Setup Steps
about a month ago
Earning a certificate in Linux Essentials from LPI
about 2 months ago

Tweets

  • Verifying myself: I am strickvl on https://t.co/bC3cv6CvI8. AMoQqVGaY1fh9AxueTLi8wnWIPwEUOvhhH4l / https://t.co/2tRFzQNIPH
    about 5 hours ago
  • "Solid Study Habits for Coders" (new blogpost) https://t.co/sEQlrHKz95
    about 11 hours ago
  • "Using Ruby's .zip method to combine arrays" (new blogpost) https://t.co/cWZlzaPXou
    about 3 days ago
  • RT @johndbritton: I'm hiring a Software Developer Apprentice, full-time and paid. There will be an emphasis on learning and quality,… https://t.co/0HLdlnSucW
    about 2 weeks ago
  • "Pain: A Love Story" (new blogpost) https://t.co/wFtZWBsa3y
    about 2 weeks ago
  • RT @BRRubin: In this article ⁦@abdulsalamzaeef⁩ reprises his classic photo role as stand-in for any random Taliban leader. Here… https://t.co/Ldm9JOSk5P
    about 3 weeks ago