Pages:
Author

Topic: Programming in Python - page 3. (Read 2695 times)

legendary
Activity: 1176
Merit: 1260
May Bitcoin be touched by his Noodly Appendage
October 12, 2013, 10:12:57 PM
#18
Yep you got it
Just two remarks: do you know you can "print cm_to_inches(1.0)" directly? And why writing ones in the formulas? Why not just "cm=2.54*inch"?
newbie
Activity: 28
Merit: 0
October 12, 2013, 10:04:36 PM
#17
Working on the functions lesson at the moment, I didn't really understand it at first. I think I've got it now as I tried to write some of my own and it outputs the correct answer. Maybe someone can check that my thinking is right on these functions I wrote.

Quote

# converts cm to inches

def cm_to_inches(cm):
    inch = 1 / 2.54 * cm
    return inch

a1 = cm_to_inches(25.4)
print a1



# convert inches to cm

def inch_to_cm(inch):
    cm = 2.54 / 1 * inch
    return cm

a2 = inch_to_cm(10)
print a2



# convert 100 to 1 (100 = 1, 500 = 5, 1000 = 10)

def onehundred_to_one(hundred):
    one = hundred / 100
    return one

a3 = onehundred_to_one(800)
print a3


# convert 1 to 100 (1 = 100, 5 = 500, 10 = 1000)

def one_to_onehundred(one):
    hundred = 100 * one
    return hundred

a4 = one_to_onehundred(5)
print a4
newbie
Activity: 28
Merit: 0
October 12, 2013, 05:09:57 AM
#16
New lessons are up.
staff
Activity: 3290
Merit: 4114
October 10, 2013, 04:49:28 PM
#15
Python being a Object orientated language is a great start. If you ever do get good enough that you know a lot, then you should also pick up other languages easier too.
hero member
Activity: 812
Merit: 1000
October 10, 2013, 04:40:41 PM
#14
Python is a great language, it is a lot quicker to code then any other language out there. It is not too slow compare to C either.

It's very slow compared to C. Sometimes 50 or more times slower. On the other hand, if your whole Python program just does one function call which does some serious number crunching, and that Python function was written in C, then sure, it's not too slow compared to C.

Python speed: http://benchmarksgame.alioth.debian.org/u32/benchmark.php?test=nbody&lang=python3&id=1&data=u32

C speed: http://benchmarksgame.alioth.debian.org/u32/benchmark.php?test=nbody&lang=gcc&id=1&data=u32

Results show C is 50 times faster and uses one tenth the amount of memory.
hero member
Activity: 812
Merit: 1000
October 10, 2013, 04:29:17 PM
#13
Do SICP http://mitpress.mit.edu/sicp/

Afterwards you can code in any language, you just need to learn it's syntax which takes a weekend.

Incorrect. Oh sure, you're going to learn Lisp, C++, Haskell and Prolog in a weekend just by learning its syntax.
member
Activity: 84
Merit: 10
October 10, 2013, 09:47:37 AM
#12
Python is a great language, it is a lot quicker to code then any other language out there. It is not too slow compare to C either.
hero member
Activity: 756
Merit: 500
It's all fun and games until somebody loses an eye
October 10, 2013, 09:44:04 AM
#11
I learned some python a while ago. I found it useful to solve the problems at projecteuler.net using python to experiment with different programming and mathematical techniques.
legendary
Activity: 1018
Merit: 1000
October 10, 2013, 09:37:53 AM
#10
I took learning a programming language as a hobby and chose python. It has been a great learning experience and really keeps your mind busy.

JackJack has been a great "guidance counselor"

So enjoy your ride...

Still got a lot of learning to do but its "educational entertainment"
full member
Activity: 126
Merit: 100
October 10, 2013, 01:40:11 AM
#9
Yeah, if you're looking to do web stuff python probably isn't the most "ideal," BUT python IS a great multi-purpose language. It can be used for so many things, much like C/C++.
newbie
Activity: 28
Merit: 0
October 10, 2013, 01:17:35 AM
#8
Just a reminder that this course has started (week 0). It's pretty straight forward but we can use this thread to assist one another if needed.
hero member
Activity: 899
Merit: 1002
September 28, 2013, 08:32:18 PM
#7
Do SICP http://mitpress.mit.edu/sicp/

Afterwards you can code in any language, you just need to learn it's syntax which takes a weekend.
sr. member
Activity: 840
Merit: 255
SportsIcon - Connect With Your Sports Heroes
September 28, 2013, 05:59:53 PM
#6
Instead of learning python, learn the OOP then you can easily learn any language. I personally think python is a descent web language. I personally like php, and JavaEE for web, and Objective-c for desktop/ios apps.
This is nitpicking, but python is not a "web language". It's multipurpose and one can code desktop programs with it (and wxPython). I did so, some time ago.
vip
Activity: 756
Merit: 503
September 27, 2013, 08:46:32 PM
#5
I'm now also registered to an initiation course to C++ but it's in french: https://www.coursera.org/course/intro-cpp-fr

I'm already semi-fluent in C++ but only learnt via source code reading and working on small projects. Maybe it will help me to start from the beginning, then there is a part 2 course for more advanced students.  
newbie
Activity: 28
Merit: 0
September 26, 2013, 10:01:27 PM
#4
Thanks for the offer of assistance.

I'll post this over at /r/bitcoin and see if we can get a small group for the 9th next month.
legendary
Activity: 1176
Merit: 1260
May Bitcoin be touched by his Noodly Appendage
September 26, 2013, 09:21:24 PM
#3
I don't know if this is the ideal language to learn if I want to develop my Bitcoin ideas, perhaps someone can offer some advice in that regard
I learnt Python and Bitcoin by looking/forking this software: https://github.com/joric/pywallet/
I think I'm now pretty good at both
I can help you if you need some help
vip
Activity: 756
Merit: 503
September 26, 2013, 08:22:59 PM
#2
I'm in! I think python is a good multi-purpose language.
newbie
Activity: 28
Merit: 0
September 26, 2013, 08:19:30 PM
#1
Hey,

I've been wanting to learn to program for a while but I never really bothered as I had no idea of what to build and so my motivation was zero. Because of Bitcoin, I have some simple ideas that I'd like to build so now is as good a time as any to learn how to program. To that end, I thought I would share with others a course on python is starting on October 9th titled "An Introduction to Interactive Programming in Python".

https://www.coursera.org/course/interactivepython

I don't know if this is the ideal language to learn if I want to develop my Bitcoin ideas, perhaps someone can offer some advice in that regard but anyway, I thought I would share the link here and see if anyone else was interested in doing this as a group, perhaps we can collaborate and help each other to learn via the forum or on irc in the #interactivepython channel.

Anyone else interested?





Pages:
Jump to: