joshwd36
Posts: 12
Joined: Sun Apr 29, 2012 6:30 pm
Contact: Website

Learning python

Wed Feb 13, 2013 8:57 pm

I am attempting to learn python, however, the way I learn programming is to be given a challenge and then work out how to do it, thus increasing my knowledge and experience of the language. Unfortunately, I am useless at coming up with challenges for myself, so if anyone has any reasonably simple challenges for me, I would love to hear them.

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: Learning python

Thu Feb 14, 2013 1:29 am

joshwd36 wrote:I am attempting to learn python, however, the way I learn programming is to be given a challenge and then work out how to do it, thus increasing my knowledge and experience of the language. Unfortunately, I am useless at coming up with challenges for myself, so if anyone has any reasonably simple challenges for me, I would love to hear them.
Maybe try creating a simple game with PyGame. I've learned a lot about programing in general and Python in particular that way. It's a good way to learn about classes and objects especially. Don't set your sights too high, try something simple first. PyGame's website has some good tutorials.

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: Learning python

Thu Feb 14, 2013 7:05 pm

No idea how good any of these are, but came across this a while ago http://sixrevisions.com/resources/10-pu ... ng-skills/
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

Godmil
Posts: 13
Joined: Sun Jan 06, 2013 8:10 pm

Re: Learning python

Thu Feb 14, 2013 7:42 pm

Calculate all the prime numbers between 1 and 100. :) that's my fav personal challenge when learning a new language, because I keep forgetting how to do it :)
You could also check out codecademy it has a brilliant collection of python lessons which are always worth a quick look to see if its your thing.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Learning python

Fri Feb 15, 2013 12:59 am

Start with a game is good way to start.
Start with a simple game, then break that simple game down into small bits of code.
So start with say a pong game.
First set up graphics, then fill the screen with a color, then draw lines to make this:

Code: Select all

xxxxxxxxxxxxxxx
x      x      x
x      x      x
x      x      x
x      x      x
xxxxxxxxxxxxxxx
Then make a square for the ball, then move the ball from left to right and back again.
Then make it move at a angle, plus detect when it hits the edge and change angle, so it bouncers off all the side.
And so on until your game is done.
Then you can work on a side scrolling game.
Batteries not included, Some assembly required.

pl259
Posts: 14
Joined: Mon Jan 28, 2013 4:11 pm

Re: Learning python

Fri Feb 15, 2013 7:53 pm

google "google python" there is a great lecture series done by google on basic python. And all projects are on the web

DaniB257
Posts: 7
Joined: Sat Aug 04, 2012 5:25 pm

Re: Learning python

Sat Feb 16, 2013 1:22 am

projecteuler.net has been my inspiration to learn python, hundreds of challenges.

User avatar
jackokring
Posts: 816
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
Contact: ICQ

Re: Learning python

Sat Feb 16, 2013 1:46 am

Work out how much percent each letter pair is used in a file, so for example this post would start by counting Wo, or, rk, ou, ut, ho, ow, mu .... and so on, and tally up how often each letter pair occurs, (or is not ro, or maybe it could be), and the divide by the number of pairs to get a decimal fraction of the total. Then for extra kudos, print the result in both alphabetic order, and percentage top most order.

Later you can extend this to do other challenges such as sw3apping the most common for the least common, and second most for second least etc, so all except perhaps the middle most, and output it as a new file.
Pi[NFA]=B256R0USB CL4SD8GB Raspbian Stock.
Pi[Work]=A+256 CL4SD8GB Raspbian Stock.
My favourite constant 1.65056745028

User avatar
stevepdp
Posts: 285
Joined: Fri Oct 28, 2011 7:41 am

Re: Learning python

Tue Feb 19, 2013 4:41 am

I'd recommend taking a look at Reddit's /r/dailyprogrammer for non language specific challenges which target several levels of programming and problem solving experience.

If you use an RSS feed reader (such as Liferea or Google Reader) then you can subscribe to the RSS for it here.

Return to “General programming discussion”