Me too.@Aurel I think Dan was writing in support of Python.
Part of the enjoyment I get from programming is using & learning new languages
luthor.jpg
"You can't stop me from using Python, Superman!"
You would think it was written in Kryptonite.I don't know where all the criticism for Python is coming from.
Me too.@Aurel I think Dan was writing in support of Python.
Part of the enjoyment I get from programming is using & learning new languages
luthor.jpg
"You can't stop me from using Python, Superman!"
Last edited by danbaron; 30-11-2011 at 07:58.
"You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields
Ok Dan,
You forced me to do it again!
You've driven me to
So I linked to MIT and found SICP:MIT (the Massachusetts Institute of Technology) is probably the number one technological university in the United States.
So I downloaded the video lectures and Scheme and DrRacket.Wizard Book n. Hal Abelson's, Jerry Sussman's and Julie
Sussman's Structure and Interpretation of Computer Programs (MIT Press,
1984; ISBN 0-262-01077-1), an excellent computer science text used in
introductory courses at MIT. So called because of the wizard on the jacket. One
of the bibles of the LISP/Scheme world. Also, less commonly, known as the Purple
Book.
from The New Hacker's Dictionary, 2nd edition
(MIT Press, 1993)
I will be really busy for a while.
Bob
Those videos were released in 1985. Are you sure the subject matter is still relevant?
Hi Bob.
I wouldn't know anything about SICP or the lectures, if not for jack (Johan).
I think the lectures were made in 1986, for a group of employees from Hewlett Packard.
I don't think I can say enough good things about Racket, DrRacket (the IDE), or the help system in DrRacket.
You can learn Racket just from the help system.
And in DrRacket, it is really really nice to be able to make a function/program at the top of the page, and immediately test it at the bottom.
Here is an example.
From inside DrRacket, copy the code shown below, into the top half of the page (the editor).
From the "File" menu, choose, "Save Definitions".
You can save it as, "factorial.rkt".
From the "Racket" menu, choose, "Run".
Go to the bottom half of the page to the prompt (">") in the REPL (read-eval-print loop).
Type what is shown at each prompt below, and press "Enter", and you should get the same output (except for the time).
If you want to start the REPL over again, just go back to the "Racket" menu, and choose "Run" again.
(While you're editing code, you can make it look nice any time you want, by going to the "Racket" menu, and choosing, "Reindent All".)
Dan
; code ---------------------------------------------------------------------------------------------------------------------------------------- #lang racket (define value 0) ; Here's a comment. (define (num-digits n) (add1 (order-of-magnitude n))) (define (time-function f n) (let ((t1 (current-milliseconds))) (set! value (f n)) (let ((t2 (current-milliseconds))) (let ((tt (/ (- t2 t1) 1000.0))) tt)))) (define (fact n) (define prod 1) (define (loop m) (cond ((> m n) prod) (else (set! prod (* prod m)) (loop (+ m 1))))) (loop 1)) (define (num-right-end-zeroes n) (define sum 0) (define (loop m) (cond ((= (remainder m 10) 0) (set! sum (add1 sum)) (loop (/ m 10))) (else sum))) (loop n)) ; REPL interactions --------------------------------------------------------------------------------------------------------------------------- Welcome to DrRacket, version 5.1 [3m]. Language: racket. > (time-function fact 1000) 0.005 > value 40238726007709377354370243392300398571937486421071463254379991042993851239862902059204420848696940480047998861019719605863166687299480855890132382966994459099742450408707375991882 36277271887325197795059509952761208749754624970436014182780946464962910563938874378864873371191810458257836478499770124766328898359557354325131853239584630755574091142624174743493 47553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871 34831202547858932076716913244842623613141250878020800026168315102734182797770478463586817016436502415369139828126481021309276124489635992870511496497541990934222156683257208082133 31861168115536158365469840467089756029009505376164758477284218896796462449451607653534081989013854424879849599533191017233555566021394503997362807501378376153071277619268490343526 25200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616 76217916890977991190375403127462228998800519544441428201218736174599264295658174662830295557029902432415318161721046583203678690611726015878352075151628422554026517048330422614397 42869330616908979684825901254583271682264580665267699586526822728070757813918581788896522081643483448259932660433676601769996128318607883861502794659551311565520360939881806121385 58600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230 48386568897646192738381490014076731044664025989949022222176590433990188601856652648506179970235619389701786004081188972991831102117122984590164192106888438712185564612496079872290 85192968193723886426148396573822911231250241866493531439701374285319266498753372189406942814341185201580141233448280150513996942901534830776445690990731524332782882698646027898643 21139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640 18215439945715680594187274899809425474217358240106367740459574178516082923013535808184009699637252423056085590370062427124341690900415369010593398383577793941097002775347200000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000 > (num-digits value) 2568 > (num-right-end-zeroes value) 249 >
Last edited by danbaron; 01-12-2011 at 08:30.
"You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields
Hi Dan
Thanks for the example.
Here are my results:
Language: racket; memory limit: 128 MB. > (time-function fact 1000) 0 > (time-function fact 10000) 0.733 > (time-function fact 100000) 87.828 > (num-digits value) 456574 > (num-right-end-zeroes value) 24999 >
hello!
1) simple python example I've explored:
2) python + GUI:import math, random (für Standardbibliothek) import math print math.sin(math.pi) from math import * print sin(pi) >>> pi = 1234 >>> pi 1234 >>> from math import * >>> pi 3.1415926535897931 from math import sin as hallo, pi as welt print hallo(welt)
after having found some example at websites related to python topics for me python isn't any more complicated to understand. you can for example load (import) modules like thinbasic. one side remember me to java, other side to basic language (imho), but I have had some problems to install python issue for windows here. I will check what's going on.# File: hello1.py from Tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() root.mainloop() # File: hello2.py from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() self.button = Button(frame, text="QUIT", fg="red", command=frame.quit) self.button.pack(side=LEFT) self.hi_there = Button(frame, text="Hello", command=self.say_hi) self.hi_there.pack(side=LEFT) def say_hi(self): print "hi there, everyone!" root = Tk() app = App(root) root.mainloop()
thanks for interesting feedback. one favour, please stay at topic, if that's possible bye, largo
OT is a major portion of the content posted here. Once in awhile we get lucky and Eros, Petr or Mike chimes in and we find out something about thinBasic.one favour, please stay at topic, if that's possible
Those videos were released in 1985. Are you sure the subject matter is still relevant?OT is a major portion of the content posted here. Once in awhile we get lucky and Eros, Petr or Mike chimes in and we find out something about thinBasic.
The title of this thread is, "learning python?".
----------------------------------------------------------------------
Implicit variable typing, variable assignment, variable incrementation, and printing the value of a variable to a console window, in Python 3:
# code -------------------------------------------------------------- sum=0 sum+=1 print(sum) # output ------------------------------------------------------------ 1
Last edited by danbaron; 05-12-2011 at 05:55.
"You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields
Bookmarks