Learntofish's Blog

A blog about math, physics and computer science

Posts Tagged ‘programming’

Learn to code with these websites

Posted by Ed on April 7, 2016

Two websites that teach you how to code are codeschool and codeacademy. They come with videos followed by interactive questions.

You can find more recommendations at:
Hongiat
Reddit
Gizmodo

Advertisements

Posted in programming, Uncategorized | Tagged: , | Leave a Comment »

C programming tutorial (by Adam)

Posted by Ed on August 29, 2013

Here is a great C programming tutorial by Adam. It’s currently made up of 87 videos where each video lasts for 5-10 minutes. I really like the drawings that illustrate what is going on in the memory.

I went through the tutorial by watching and simultaenously copying the source code. And before I would go to the next video I recreated the code from memory which I found best to learn the concepts.

Posted in computer science | Tagged: , , , | Leave a Comment »

More programming puzzle websites

Posted by Ed on November 22, 2012

Jagadeesh from SkilledMonster posted a nice collection of programming puzzle websites.

I mentioned another collection earlier here.

Posted in computer science | Tagged: , , , | Leave a Comment »

How to get started with Topcoder

Posted by Ed on November 22, 2012

If you want to improve your programming skills, I highly recommend Topcoder. Unlike projecteuler which is heavy on number theory Topcoder focuses on algorithm design. In the live competitions you are given three problems that you can try to solve within a time limit. There are two divisions. Division 2 is for beginners whereas Division 1 is for those with a higher ranking.

Here are some nice tutorials on how to get started:
Getting Started on Topcoder
TopCoder Quickstart Tutorial

You do not have to participate in the competitions. You can also just use the archive to practice:
– Go to the problem archive.
– Click on Div2 Success Rate. This will sort the problems from easy to hard. You can then start working on the problems where the difficulty gradually increases.
– After compiling, testing and submitting your solution don’t forget to run the system test. For this, click on Practice Options -> Run System Test.
– Browse through other people’s solution and learn new tricks. This is a nice feature on Topcoder.

After some practice you should compete in one of the live competitions. First, it is very exciting and fun. Second, you learn to write correct code fast. Third, you read other people’s code during the challenge phase.

By the way, Mark Zuckerberg also has a profile on topcoder.

Posted in computer science | Tagged: , , , | 1 Comment »

How I learned to code

Posted by Ed on January 24, 2012

Read this very interesting story by James Somers in which he describes how Projecteuler helped him to finally learn programming. I wrote about Projecteuler earlier here.

My first program was on a Vtech laptop for kids. It had a BASIC interpreter. The code required you to specify the lines (yes, good old times) and use the goto command to write loops.

Posted in computer science | Tagged: , | Leave a Comment »

Tutorial: Object Oriented Programming in Python – Part 8

Posted by Ed on December 11, 2011

Update (03 Jan 2012):
When I wrote this tutorial I erroneously assumed that call by value and call by reference also exist in Python. However, I learned today that this is not the case. In Python you have something called call by object reference meaning:
– The value of a reference is copied. Keep in mind that the value of a reference is an address (see further reading down below).
– Everything in Python is an object, even integers. For example, b=1 means an object with value 1 is created (right hand side) and b (left hand side) is a reference to that object. Try this in the Python-Shell:

>>> b = 1
>>> id(b)
505497992
>>> b = 3
>>> id(b)
505498024

With id() you can check the address of b. You will notice that b has another address after the “assignment” b=3.

See my post: Call by Object Reference (Call by Sharing)

The section below was written before I knew about call by object reference.
—————————————————
 

This is the continuation of the Python OOP tutorial. Here I want to talk about the difference between call by value and call by reference. Besides, I’ve already explained something similar using C++ here.

Example 1 – Call by value:
Consider this code Read the rest of this entry »

Posted in computer science | Tagged: , , , , , , , | Leave a Comment »

Tutorial: Object Oriented Programming in Python – Part 6

Posted by Ed on December 10, 2011

This is the continuation of the Python OOP tutorial. Here, I will talk about modules in Python.

Before I address modules I want to Read the rest of this entry »

Posted in computer science | Tagged: , , , , , , , , , , , , , | Leave a Comment »

Tutorial: Object Oriented Programming in Python – Part 5

Posted by Ed on December 10, 2011

This is the continuation of the Python OOP tutorial. Here, I will talk about inheritance. The general syntax is:

class DerivedClass(BaseClass)

Example:
Last time (in part 4) we wrote a Vehicle class that allowed us to create objects with Read the rest of this entry »

Posted in computer science | Tagged: , , , , , , , , , , , | 3 Comments »

Python: Difference between print and return

Posted by Ed on December 9, 2011

When I began programming I was confused by the difference between print and return. Here, I want shed some light on the difference.

Consider the Read the rest of this entry »

Posted in computer science | Tagged: , , , , , , , , , | 3 Comments »

Tutorial: Object Oriented Programming in Python – Part 4

Posted by Ed on December 9, 2011

This is the continuation of the Python OOP tutorial. Today I describe how to change an attribute in a simple Vehicle class:

class Vehicle:

    def __init__(self, speed):
        self.speed = speed
        print("You have just created a vehicle.")

    def accelerate(self,x):
        self.speed = self.speed + x

    def brake(self,x):
        self.speed = self.speed - x

    def status(self):
        print("The speed of the vehicle is", self.speed, end=" km/h.")

Save the code in a file vehicle.py and Read the rest of this entry »

Posted in computer science | Tagged: , , , , , , , , | Leave a Comment »