Woll
Posts: 472
Joined: Mon Jul 06, 2015 2:14 am
Location: Cloud Cuckoo Land

Difference between Python 2 and Python 3

Mon Sep 21, 2015 10:45 pm

I've been wondering what are the main differences between Python 2 and Python 3?

I had both a ZX81 and a Commodore 16 as a kid and Python doesn't seem that different to the Basic they used.
But I have to admit, I'm enjoying typing code from MagPi into my Raspberry Pi as it's bringing me back to my youth.

And Python does seem interesting, it just seems a question of understanding what things like the semi colon does to the code that comes after it to understand it better.

But if I remember rightly, didn't Sinclair Basic use scientific calculations in its code?
Who ate all the Pi's? Who ate all the Pi's?
Boris Johnson, Boris Johnson,
Who ate all the Pi's?


metalj
Posts: 212
Joined: Sat Feb 07, 2015 11:56 pm

Re: Difference between Python 2 and Python 3

Tue Sep 22, 2015 1:31 am

I worked briefly on basic and what little I recall provided context for python. I am working on python 3 now. I suggest teach your kids to code by bryson payne book and udemy course and automate the boring stuff with python by al sweigart book and udemy course. Both cover python 3 and will get your foot in the door.
Backspace 28 times :)

User avatar
r3d4
Posts: 967
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: Difference between Python 2 and Python 3

Tue Sep 22, 2015 8:40 am

Difference is +1 . :lol:

scotty101
Posts: 3648
Joined: Fri Jun 08, 2012 6:03 pm

Re: Difference between Python 2 and Python 3

Tue Sep 22, 2015 9:01 am

Start with Python3 unless you have a brilliant reason to use 2.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Woll
Posts: 472
Joined: Mon Jul 06, 2015 2:14 am
Location: Cloud Cuckoo Land

Re: Difference between Python 2 and Python 3

Tue Sep 22, 2015 8:46 pm

Thanks for the replies.
I'm thinking of getting Python in easy steps.
Is this book any good?
Who ate all the Pi's? Who ate all the Pi's?
Boris Johnson, Boris Johnson,
Who ate all the Pi's?

User avatar
mattrix
Posts: 131
Joined: Mon Mar 02, 2015 6:20 am
Location: Christchurch, New Zealand
Contact: Website

Re: Difference between Python 2 and Python 3

Tue Sep 22, 2015 11:12 pm

print "hello world"
vs
print("hello world")

That's it :)
(Not really)
www.matthuisman.nz


Woll
Posts: 472
Joined: Mon Jul 06, 2015 2:14 am
Location: Cloud Cuckoo Land

Re: Difference between Python 2 and Python 3

Wed Sep 23, 2015 9:25 pm

Thanks alot for the links. I'll give the course a go.
I'd love to be able to program. :D
Who ate all the Pi's? Who ate all the Pi's?
Boris Johnson, Boris Johnson,
Who ate all the Pi's?

User avatar
r3d4
Posts: 967
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: Difference between Python 2 and Python 3

Fri Sep 25, 2015 10:19 am

r3d4 wrote:Difference is +1 . :lol:
=[ i was rong most likely the diff is 0.3 !

For a more meaningful diffrence
try this
http://learnxinyminutes.com/docs/python/#2.7
and that
http://learnxinyminutes.com/docs/python3/

gordon77
Posts: 4065
Joined: Sun Aug 05, 2012 3:12 pm

Re: Difference between Python 2 and Python 3

Fri Sep 25, 2015 12:12 pm

r3d4 wrote:
r3d4 wrote:Difference is +1 . :lol:
=[ i was rong most likely the diff is 0.3 !

For a more meaningful diffrence
try this
http://learnxinyminutes.com/docs/python/#2.7
and that
http://learnxinyminutes.com/docs/python3/
or 0.5 ?

3.2.3 - 2.7.3 ?

User avatar
r3d4
Posts: 967
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: Difference between Python 2 and Python 3

Fri Sep 25, 2015 3:20 pm

gordon77 wrote: or 0.5 ?

3.2.3 - 2.7.3 ?
Image
python -V
#Python 2.7.9

python3 -V
#Python 3.4.3
*not from linux runing on PI ; fyi

Perhaps someone should write a python program to calculate the answer !

Return to “Python”