Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Saturday, June 8, 2013

Learning the popular programming languages easily

I know learning programming is huge deal. Its either reading those huge tutorials with examples and sometimes get information which you might not need to know so hard. Sometimes, its just enough that you learn the syntax and some important components of the language. Sometimes, programming is learnt for fun and not for you know, "professional development". Sometimes, even for show-off.
However simple the reason might be, my point is sometimes programming is not so serious when it comes to an enthusiast. Hence, I found three website that belong to the same network which lets you learn programming easily and conveniently. Where, the testing is just below the subject matter. Where theory and practical use can be learnt under the same page. Something that the owners call it: Interactive Learning Platform.
Python, C, and Java are three of the most widely used programming languages in the world and hence the websites:
LearnPython.org: Interactive Python Tutorial: http://www.learnpython.org
LearnJavaonline.org: This one's for Java: http://www.learnjavaonline.org
LearnC: And the final one for the most basic language C: http://www.learn-c.org/
  

Friday, June 7, 2013

Python Code Snippets: To get the sum of digits of a number

Sum of digits of number '123' is 1 + 2 + 3 = 6
What could the sum of digits of factorial of 100 which has 158 digits?
Either, you can calculate 100! and sum up the digits using a calculator, or use this simple python function:

"

import math
def sum_digits(n):
   import math
   total = 0
   for i in range(int(math.log10(n)) + 1):
      total += n % 10
      n //= 10
   return total
#taking the input
n = input()
print sum_digits(n)

"

More snippets to come soon...