So weird - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32) +---- Thread: So weird (/showthread.php?tid=26423) |
So weird - Miku - 06-02-2012 Quote:I'm trying to learn Python, I installed Python 2.7.3 and for some reason, when I watch "TheNewBoston" video, I typed the same code as him, save as .py, i couldn't double click on the .py file to execute it. I right click and check the filetype is just "file".thanks. but is there a differences between python 3 and 2? I tried 3 and some codes for 2 is not working. RE: So weird - Daniel Faraday - 06-03-2012 There are only very small differences between 3 and 2, and the only one you'll encounter (most likely), as a beginner, is print('Hello') working in both, but print 'hello' working only in 2. @Your Problem: To not have to add a print or stop, you should just use idle. Open idle > file, new window> f5 to execute RE: So weird - Miku - 06-03-2012 Also, when I type this >>> x = input("Enter number here: ") Enter number here: 4 >>> x + 1 In 2, it give me 5, but in 3, it gives me error, something about integer and string... RE: So weird - Daniel Faraday - 06-03-2012 I'm not sure what you're trying to say, but you could try putting: Code: x = int(input("Enter your number here: ")) Nevermind, I just realized you were talking about the version of python. Adding int should work, because of the differences between raw_input and input in 2 and 3. The difference is that 3 does not have a raw_input function, input is what raw_input is in 2. RE: So weird - MC111 - 08-21-2012 I would recommend staying with version 3. I know version 2 has more tutorials and overall more support, but 3 is way forward and tbh there are only very minor differences that can easily be identified and solved when stumbled upon. |