Tag Archives: Python

How to learn to code – other people’s advice /5

I am glad to see that some of the readers are taking advantage from some of the advice I got from other programmers.

Here is another advice I received:

I’ve never tried a freelance site yet. However, I am working on freelance projects for 3 outside companies now. They found me themselves on LinkedIn. Hmm….I think it’s too early to try to get a software job. I don’t know if people would hire you with no experience. You can always try, of course.

Whatever way you can learn and get experience, go for it. A good way is to contribute to open source projects. That means you must first learn GitHub and Git. Look at popular projects on GitHub: https://github.com/explore

Here’s a popular Python project: https://github.com/poise/python

Here are current “issues” for this project. Problems, bugs, features that they need someone to fix for them: https://github.com/poise/python/issues

Here are the latest “commits” (code uploads) to its master branch. You learn a lot from studying what code changes people make to a project: https://github.com/poise/python/commits/master

Here are its latest “pull requests” (new code changes that developers are asking the main developer to accept for merging in the master branch): https://github.com/poise/python/pulls

See? Study how code gets made and changed day by day by studying these details for different projects on GitHub. Feel free to contribute your own changes/issues/fixes to a project. People are very picky about what code they will accept. If they reject your code, they will give you comments and tell you what to fix/improve. This whole culture of contributing to open source projects on GitHub will teach you the daily process of software development.

We do the exact daily routine at work. We have meetings every 2 weeks to figure out the main issues each of us will work on in 2 week “sprints.” Then each morning we meet and talk about what we’ve accomplished so far. We each make a new branch on GitHub to work on our feature or bug fix. Every day we commit and push new code to that branch. When we feel we’re done, we make a “pull request” to our boss to merge our branch with the main branch. He may accept it or reject it with comments on how to improve our code. We also do a demo every 2 weeks to management and our team of what we’ve done.

That’s how our job is like. So yeah, eventually try fixing problems people have on different projects on GitHub. That’s a fantastic way to really learn and get critiqued by experienced software developers worldwide. IF you have a bunch of open source contributions highlight that on your resume. That’s impressive, because it means your code is up to their high standards.

Here’s the prework site for my school, Flatiron. They give you a bunch of suggested tutorials/links to prepare to be: 1) a Ruby on Rails web developer or 2) an iOS developer. http://prework.flatironschool.com/

You don’t have to cover everything. First just focus on your main language (like Python). Eventually you’ll have to become a T (deep knowledge in 1 main language, with broad more superficial knowledge in several other languages).


How to learn to code – other people’s advice /4

I still have quite a lot of other programmer’s advice so here is the 4th post about it.

I do hope that you find this serie (other people’s advice) useful and that you can learn from it. Because previous answer was too long I am posting the second part of the answer here, which makes it advice No. 4 already.

I started with Project Euler and did 50 problems on it.

The wonderful thing about Project Euler is they have discussion forums where programmers from around the world post over 200 solutions to the same problem, in 20+ languages, from 20+ countries. You may only go into the discussion forum for a problem when you get the right answer. After you do that, you learn SO MUCH from seeing how other people solved your same problem in much better, faster, and more efficient ways than you, in multiple languages. Then you rewrite your solutions to incorporate those coding and algorithm tricks you learn from others.

Spending weeks solving Project Euler was extremely frustrating but incredibly stimulating for my mind and really valuable later on. Those are some of the toughest problems you can do, and you can use any language you wish (or multiple languages). The specific languages DOES NOT MATTER. What matters during job interviews is HOW YOU THINK AND ANALYZE PROBLEMS. That’s what companies seek—people who can adapt quickly, in any language, to any programming challenge a job throws at you. You can hone your coding skills by doing tough programming challenges like those sites I listed above.

Once you can do tough challenges like Project Euler, everything else in programming (building websites, etc.) will seem easier to you. It’s like doing pushups for your mind. Or running a marathon. Once you can do that, then running a kilometer is easy.

How this guy used Project Euler to learn how to code:


The problem with bootcamps is they don’t focus on hard coding challenges, which teach data structures and algorithms. Those skills are the toughest parts of software job interviews, where people will ask you to code on a whiteboard with a marker. No computer or Internet. Just using your brain and standing in front of some engineers, talking about your code solution extemporaneously.

Bootcamps are good at teaching you limited skills about how to make specific kinds of websites, but they aren’t good at teaching how to deal with fundamental computer science (data structures and algorithms), which teaches you how to respond to completely new challenges you’ve never seen before. Doing problems from code challenge websites teaches you that. Also, post all your solutions on GitHub. Your GitHub will become your resume for software jobs.

Ooh, I just saw your blog: http://teacod.com/. Wonderful! Many of my Flatiron classmates also wrote blogs about their learning experiences. Nisha Batra wrote one of my favorite, detailed blogs about learning to code: http://nishacodes.tumblr.com/archive

This guy in LA, Daniel Greenfield and his wife Audrey Roy are Python/Django experts. They travel around the world giving talks on these subjects. They wrote the book “Two Scoops of Django”: http://twoscoopspress.org/products/two-scoops-of-django-1-6

Ask me if you have any technical questions.

How to learn to code – other people’s advice /3

I strongly believe in sharing the information and knowledge. This is why I started with series of posts: How to learn to code – other people’s advice /

As you already know I am posting some parts of the e-mail answers from some of the programmers that I have asked for advice when I started learning to code.

I do hope you will find useful information in this post:

Hi Aleksandar, I haven’t heard of The Firehose Project before: http://www.thefirehoseproject.com. Their website has no information on their curriculum and what languages/technologies they teach, however.

One of the people in my group is going through The Odin Project (http://www.theodinproject.com/courses?ref=home_b), which is free and may be something you’d like.

I’d gone through the first 2 courses in Tealeaf Academy before I did my live Flatiron School bootcamp: http://www.gotealeaf.com/

There are different sites that compare different web development bootcamps. Here are some online ones:




You have more and more choices now. Notice they have live bootcamps in Europe too.

If you pick an online bootcamp, you should also try to meet software developers in your city (Ljubljana), which you can find from sites like Meetup.com. Join Meetup.com and look around. You may be surprised from the groups you find near you! You need to meet people in person who would like to study together. Perhaps you could start your own Meetup group (which I did) to find study partners.

Let me know what you finally decide. There’s no right or wrong choice. 

Also, Udemy has been having lots of discounts on their online courses. Keep an eye out for future discounts.

Also, see what Jennifer Dewalt did. She was a San Francisco artist who taught herself to code by building 180 websites in 180 days. Crazy, but she achieved her goal of making 1 website per day. She taught herself everything—-HTML, CSS, JavaScript, Ruby, Rails, databases, etc. See her blog about each site, with her links to every site. She used this ambitious schedule to teach herself and practice as she went along.



Now she’s running her own restaurant review business, based on a site she created.

The important thing for you is to start coding every day. It’s like learning multiple foreign languages and new ways of thinking at once.

Create a GitHub account and learn to use Git to put all your code online for everyone to see. All software developers in the world have GitHub accounts, and that’s how we share code, learn from each other, and build on top of other people’s code. The best way to learn to code is to just start doing it, trying different code challenges, learning from reading others’ code, then rewriting your programs to improve them.

Start trying different code challenges from sites like https://projecteuler.net/http://www.codewars.com/abouthttps://www.hackerrank.com/https://www.interviewcake.com/https://code.google.com/codejamhttp://community.topcoder.com/tc?module=Static&d1=tutorials&d2=alg_index.

Code challenges are really tough and let you compete against some of the best programmers in the world. They can be more mathematical, but their questions are typical of what companies ask you in job interviews. Doing well on code challenges is what will help you get software jobs. They are tough but very intellectually stimulating and fun, if you like math and solving puzzles.


How to learn to code – other people’s advice /2


today I will post you part of another advice from a great programmer and person. If you are new to the world of the programming you may find this piece of text useful. I surely hope it will be useful.  I deleted some parts of the text that are not informative.

Here is the advice:

I hope you’re still going strong and haven’t lost confidence or interest! 

There are tons of good Git tutorials out there, but I have no idea how I’ve learned to use it. I’m sending you a presentation by one of my friends, I think it explains some of it quite well, and here’s another resource: https://dont-be-afraid-to-commit.readthedocs.org/en/latest/git/index.html  This is part of a great couse about committing to Django (open source project! :)) but you don’t really have to care about this kind of stuff just yet. These might not be the most beginner-friendly resources on earth but I can’t seem to remember better ones. If you totally don’t understand something, just ask me! 

Here’s a talk I saw about making your first contribution to open source. While it might be a bit early for you to think about that, it’s worth watching! 🙂https://www.youtube.com/watch?v=x78LukPdwiM

About conferences: the one I attended was EuroPython in July, that’s a pretty big one, but there are also some named PyCon, and you could check out DjangoCon as well. http://www.pycon.org/ 

Yes, I only learned Python for about 3 months, only then I started HTML and CSS, and web development in general. But I think it’s nice to know about these two early on 🙂 

One tip I wish I knew earlier when I was a beginner: I read you’re using Notepad which is cool, but you’ll need a proper text editor later, when you’re making more complex projects. Maybe it’s a good idea to get used to using one! You’ve probably met something like Sublime Text in the Django Girls tutorial. That’s the one I’m using too and it has so many awesome features! (I think I only know about like 10% of them:) ) For example, there’s syntax highlighting. The editor highlights different parts of the code with different colors so it’s easier to read and navigate. You can also use a multiple selection, like you had not one but ten or whatever cursors, so you can edit ten different occurrences of a word at the same time. So cool! Also, you can open whole projects with this, not just single files, and it’s much easier to work with this. 

You’ve probably heard already that “real developers use Linux”. It’s clearly an exaggeration, everyone uses what they like to use. But I switched to Linux from Windows about a year ago and I haven’t regretted it a bit. It’s so much easier learning to code in Linux, all the coder tools work so much better with it. Windows is famous for being hard to make it work if you’re a developer 🙂 So I’d suggest researching about Linux a bit if you feel like it. (If you’d want to install it but aren’t 100% sure, there’s a great solution: you can make your computer dual-boot – that mean you have two operating systems on it, and you decide which one to boot when you start your machine. That’s how I’m doing it, btu I’m hardly ever booting into Windows anymore. I suggest you give it a try!) 

How to learn to code – other people’s advice /1

It has been very busy period. I am in the middle of my residency application, completing a book and many other interesting projects. Months ago when I was gathering the information about how to learn to code I e-mailed few programmers.

I got this idea that it may be useful to share some of the advice with you. So here is the first advice:

Thanks for writing to me. I think it may be difficult to get paid for small programming projects while you build up your expertise. I recommend contributing to open source projects as a way to build up expertise quickly. Given your medical background, are there any programming or system administration jobs at universities or medical facilities?

Some resources that might be helpful:

A video tutorial on open source contribution

Training missions on common open source tools

Practice Python projects


I keep going with the Coursera course on Python by dr. Charles Severance. Class is really well constructed and I would warmly recommend it to all programming newbies.

Yesterday It took me quite a lot of time to solve the exercise. I experienced two things:

1. It is important to pay attention to details. I knew that but obviously did not remember lesson well as I was furiously looking for the solution while it was really obvious and would have appear to me much earlier if I would have been more precise. Once again: pay attention to details. 

2. The second experience was a joy of making my longest program so far. For an experienced programmer this piece of code will look very easy but for me it was the top of the mountain. If you have write the right solution, the right code either for given exercise or some problem of your own, you will know what I am talking about.

So here is the exercise:

Write a program that repeatedly prompts a user for integer numbers until the user enters ‘done’. Once ‘done’ is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter the numbers from the book for problem 5.1 and Match the desired output as shown. 

This is my first solution which I was so sure it was right but it was not:

largest = None
smallest = None
while True:
num = raw_input(“Enter a number: “)
if num == “done” : break

num = int(num)
print “Invalid input”

if largest is None or num > largest:
largest = num

if smallest is None or num < smallest:
smallest = num

print “Maximum is”, largest
print “Minimum is”, smallest

And this is the right solution. Do you notice the difference. Run the code if you are not sure.

largest = None
smallest = None
while True:
num = raw_input(“Enter a number: “)
if num == “done” : break

num = int(num)
print “Invalid input”

if largest is None or num > largest:
largest = num

if smallest is None or num < smallest:
smallest = num

print “Maximum is”, largest
print “Minimum is”, smallest


P.S. I apologize for writing code without proper identation. If you know how could I write nicer lines of code here in wordpress please let me know. 

Expansion of topics and why do I write

I started this blog when I started to learn to code. There were more than one reason for this action. I wanted to share my experience and through writing connect with other same minded self-teaching programmers. Because for a medical graduate diving into the world of codes was (and it is still) quite a scary experience. PowerShell, binary system, black screen, syntaxerror… For somebody whose computer knowledge stopped at writing and saving word document or posting a tweet this was difficult new world to understand. In addition, medical graduates in general are not good problem solvers. We do memorize a lot of medical facts which I believe affects our capability for problem solving and creative thinking in a negative way. We need to become actively aware of this problem and try to solve it. I sometimes envy programmers. Even though I heard more than once that programming can be very mundane and boring, I still think that it gives one a lot of creative freedom and it is a great skill that enables us to build new things. This is one side of the story, the first reason I started to learn to code. The second part is this digital-tech-startup-healthcare-disruption media hype. Entrepreneurship is very appealing. Freedom and privilege to design, create, construct new things. What a great occupation. And vast majority of start-ups are in the tech field where programming skill seems to be as basic as knowing how to write and read. Without knowing how to programme one is considered illiterate. So there I had two big reasons to start my coding journey.

I am not working as a fron-end developer in some tech start-up of course but despite the fact it was worth starting to learn new skill. I would warmly recommend it to medical students and graduates as well because it helps to broaden one horizons. Just the fact that I started to learn to code opened numerous opportunities and experiences to me. So I may not finished working as a developer (which I strongly believe will never happen) but new insight into the how computers work and new people from the tech field that I met while on this learning journey was great privilege and benefit.

At the moment I consider programming as a hobby. I learn in my free time after work, after finishing research articles, after finishing columns and interviews. So I do not have much time left but I will keep learning. At least I need to finish Zed Shaw Learn Python the Hard Way and Coursera course on Python. Started needs to be finished ! For this reason I will expand my writing repertoire on this blog. I will add topics about medicine, medical entrepreneurship, digital healt, mhealth, about writing itself and so forth. Some may consider this as a bad move because some think that it is better to keep your blog in a narrow niche. Yes, this has some logic in it but I am not under pressure of getting 1000 subscribers in one month or making my blog profitable. Not at all. The main reason of writing this blog is communication. Leo Tolstoy wrote that communication with other people is one of the greatest pleasures. Communication will remain the most powerful tool in medicine, despite all technological breakthroughs.

This is why I write.

Input from a user

One of the very first exciting things that I learnt about Python was how to write a program that will demand an input from me.

In python 2.x the command to do that is raw_input. It can be used like this:

name = raw_input(“What is your name ?”)

print “Hello %r. You have a nice name.” % (name)

Another way of getting an input from a user is with argv. So you should type this into your  text editor:

from sys import argv

script, name = argv

print “Hi %r. You have a nice name.” % (name)

In line 2 there is script written before the name. This is because when you will open your script (the .py file with the code that we have just learnt) in the PowerShell (Windows users) you will need to open it by writing python test.py Alex

In this case the output in the PowerShell is: Hi Alex. You have a nice name.

Now, try to write a code without this script word and run it. Do you notice any difference ?

Why did I give up on edX programming course ?

I applied to this Introduction to Computer Science and Programming Using Python before I learnt to tell the difference between HTML and Python. I was looking forward to the start of the course that was scheduled for the beginning of the january. In meanwhile I have already learnt some basics so I was like: “Fine, first few lessons on this edX course will be a great revision of material that I have learnt on Python so far. ” I was wrong. I did understand first few videos and solved some of the first exercises quickly but already into the second half of the second week of the course the lessons became very difficult. One is true, I was not able to give as many hours as it was proposed by course organizators. Their estimated effort was 12 hours per week. But despite that fact I believe that the best explanation is the trap door effect: It started out easy, proceed gradually and then (at least for me) around the second half of the 2nd week the bottom would fall out. I am not saying that you should not start this course, which by my opinion is of big quality. My point is that the the basics should be explained more gradually, regarding the fact that the course is introduction to CS and Python.

I am continuing with Zed Shaws LPTHW, which at the exercise No. 18 is getting trickier as well 🙂

Three double-quotes

This is much easier than understanding binary system. I came across this trick in the Chapter 9 of the LPTHW.

The trick is called three double-quotes. I find it quite useful. You can use it for instance like this:

print “””
It is annoying to type double-quotes.
I wonder if there is way to avoid it.
I learnt a trick from LPTHW.
It is called three double-quotes.
I wonder what will be the output of this code.

I recommend you to type, run and check the code output 😉