Bitcoin Forum
May 24, 2024, 08:56:46 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 »  All
  Print  
Author Topic: Programming in Python  (Read 2652 times)
gangplank (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
September 27, 2013, 12:19:30 AM
 #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?





01BTC10
VIP
Hero Member
*
Offline Offline

Activity: 756
Merit: 503



View Profile
September 27, 2013, 12:22:59 AM
 #2

I'm in! I think python is a good multi-purpose language.
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1255


May Bitcoin be touched by his Noodly Appendage


View Profile
September 27, 2013, 01:21:24 AM
 #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

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
gangplank (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
September 27, 2013, 02:01:27 AM
 #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.
01BTC10
VIP
Hero Member
*
Offline Offline

Activity: 756
Merit: 503



View Profile
September 28, 2013, 12:46:32 AM
 #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.  
Wipeout2097
Sr. Member
****
Offline Offline

Activity: 840
Merit: 255


SportsIcon - Connect With Your Sports Heroes


View Profile
September 28, 2013, 09: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.

███████████████████████████████████████████████████████████████
██▀       ▀█       ▀████████████        ▀█         █▀       ▀██
██   ▀██▄▄▄█   ██   ████████████   ███   ████   ████   ▀██▄▄▄██
███▄     ▀██       ▄████████████       ▄█████   █████▄     ▀███
██▀▀▀██▄   █   █████████████████   █▄  ▀█████   ████▀▀▀██▄   ██
██▄       ▄█   █████████████████   ██▄  ▀████   ████▄       ▄██
███████████████████████████████████████████████████████████████
██       ██▀      ▀█████████████    ▀██   █████████████████████
████   ███   ▄██▄   ████████████     ▀█   █████████████████████
████   ███   ████████   ████   █   ▄  ▀   █████████████████████
████   ███   ▀██▀   █   ████   █   █▄     █████████████████████
██       ██▄      ▄███        ██   ██▄    █████████████████████
███████████████████████████████████████████████████████████████
██████████████
██
██
██
██
██
██
██
██
██
██
██
██████████████
████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████                                                             ████████████████████████████████████████████████
.
.
.

████████████████████████████████████████████████████████████          ████████████████                                 ██████████████████████████████████████████████████████████████████████████████████████
██████████████
██
██
██
██
██
██
██
██
██
██
██
██████████████
███████
██
██
██
██
██
██
██
██
██
██
██
███████
███████
██
██
██
██
██
██
██
██
██
██
██
███████
►►  Powered by
BOUNTY
DETECTIVE
moni3z
Hero Member
*****
Offline Offline

Activity: 899
Merit: 1002



View Profile
September 29, 2013, 12:32:18 AM
 #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.
gangplank (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
October 10, 2013, 05: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.
termhn
Full Member
***
Offline Offline

Activity: 126
Merit: 100


View Profile
October 10, 2013, 05: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++.
vite
Legendary
*
Offline Offline

Activity: 1018
Merit: 1000


View Profile
October 10, 2013, 01:37:53 PM
 #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"
Peter Lambert
Hero Member
*****
Offline Offline

Activity: 756
Merit: 500

It's all fun and games until somebody loses an eye


View Profile
October 10, 2013, 01:44:04 PM
 #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.

Use CoinBR to trade bitcoin stocks: CoinBR.com

The best place for betting with bitcoin: BitBet.us
dragonkid
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile
October 10, 2013, 01:47:37 PM
 #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.

FirstAscent
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000


View Profile
October 10, 2013, 08: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.
FirstAscent
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000


View Profile
October 10, 2013, 08: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.
Welsh
Staff
Legendary
*
Offline Offline

Activity: 3276
Merit: 4111


View Profile
October 10, 2013, 08: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.
gangplank (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
October 12, 2013, 09:09:57 AM
 #16

New lessons are up.
gangplank (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
October 13, 2013, 02:04:36 AM
 #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
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1255


May Bitcoin be touched by his Noodly Appendage


View Profile
October 13, 2013, 02:12:57 AM
 #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"?

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
01BTC10
VIP
Hero Member
*
Offline Offline

Activity: 756
Merit: 503



View Profile
October 13, 2013, 02:15:51 AM
 #19

You can share your code with CodeSkulpor for easier review: http://www.codeskulptor.org/#user19_HWWqVRQDa8_0.py
I don't know the exact formula but the code looks good to me.

I just finished everything for this week.  Cheesy
01BTC10
VIP
Hero Member
*
Offline Offline

Activity: 756
Merit: 503



View Profile
October 13, 2013, 02:18:04 AM
 #20

do you know you can "print cm_to_inches(1.0)" directly?
You are right but he did it the way it is taught in the video. I guess it is easier for beginner to understand.
Pages: [1] 2 3 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!