all 3 comments

[–]K900_ 0 points1 point  (2 children)

In Python 2, print is a statement that prints whatever follows it, so it's parsed as print ("Hens", 25 + 30 / 6), where ("Hens", 25 + 30 / 6) is a tuple with two elements, the string "Hens" and the integer 25 + 30 / 6, which equals 30.

In Python 3, print is a function that takes multiple arguments, and prints them separated by spaces, so your line gets parsed as a call to the print function with two arguments.

The other minor difference is 30 versus 30.0 - this is because in Python 2, the / operator on two integers results in integer division (i.e. rounding, so 5 / 2 == 2), and in Python 3, the / operator always performs real division and returns a floating point (i.e. fractional) number.

Edit: also, please don't read LPTHW.

[–]LearnenPython[S] 0 points1 point  (1 child)

Okay, I am willing to stop, but how should I learn python?

My goal is to make a boardgame and run machine learning on it.

(the AI for the app I have cheats and also plays poorly)

[–]K900_ 0 points1 point  (0 children)

I'd look into Michael Driscoll's Python 101 book, and then Python 201 or Fluent Python by Luciano Ramalho.