Login Register






Tutorial Introduction to Python Programming - #1 Setup + Basics filter_list
Author
Message
Introduction to Python Programming - #1 Setup + Basics #1
This is a series I'll be doing as requested by @phyrrus9, and following pretty much the same pattern as his C Programming Tutorial.

Python is a general-purpose and simple, high-level programming language. It's easy to read and write, and is suitable for many small and large scale implementations. I'm not going to go into extreme detail, but enough to get you onto your own feet. After that, it's up to you to learn the language further.

In this series I will be using Python3, but there's not much difference between the two. Once you know the basics of one, it'll be trivial to switch between them. I will be doing this in Debian, but the instructions are pretty much the same for Windows.

Let's get started.

First of all, you'll need to install Python3. This shouldn't be difficult so I'll leave you to it. You can either download it from here, or use your package manager.

We'll also need a text editor. I'll be using nano:

Code:
sudo apt-get install nano

Here's how to use nano: [link] Once you've done, open your terminal as root:

Code:
su

Now here's how to work with Python in Debian. First, create the file that you'll be using. The file format is '.py'.

Code:
nano first_script.py

It'll create and open the file, and let you edit the contents.

Code:
print("Hello, World!!!")

Enter the above line and then ^O. This'll write to the file. To close the file, ^X.

Then enter:

Code:
python first_script.py >>>Hello, World!!!

Done. Now you should understand how to work with Python in a GNU/Linux environment. The next part of this series will teach you Python from the ground up. *tips cap*


RE: Introduction to Python Programming - #1 Setup + Basics #2
A few months ago I was giving you tips on how to start out with Python and you're already making tutorials?
You aren't even explaining the differences between Python3 and lower, most Linux users will probably already have Python2.7 or 2.6/2.4 installed because a lot of things depend on it.
Not even all packages have been updated to Python3 yet. Oh and why was logging in as root necessary here? Nano and Python work perfectly fine without root.

No offense to anyone but Phyrrus isn't exactly the best person to take as a role model, not only does he abuse his powers here but he makes tutorials about things he doesn't even quite understand yet but he can't handle the criticism either.

Just don't turn out to be like him, dedicate your time to actually learning and trying to master the language before you create tutorials for it.


RE: Introduction to Python Programming - #1 Setup + Basics #3
(01-21-2015, 04:10 PM)blackhatcat Wrote: A few months ago I was giving you tips on how to start out with Python and you're already making tutorials?
You aren't even explaining the differences between Python3 and lower, most Linux users will probably already have Python2.7 or 2.6/2.4 installed because a lot of things depend on it.
Not even all packages have been updated to Python3 yet. Oh and why was logging in as root necessary here? Nano and Python work perfectly fine without root.

No offense to anyone but Phyrrus isn't exactly the best person to take as a role model, not only does he abuse his powers here but he makes tutorials about things he doesn't even quite understand yet but he can't handle the criticism either.

Just don't turn out to be like him, dedicate your time to actually learning and trying to master the language before you create tutorials for it.

I more created the tutorial to learn than to teach, but I understand your point of view. Of course I know I'm no pro, but I'm better than he who knows nothing, so I'll teach what I do know.

su was just a precaution.


RE: Introduction to Python Programming - #1 Setup + Basics #4
(01-21-2015, 04:18 PM)Eclipse Wrote: I more created the tutorial to learn than to teach, but I understand your point of view. Of course I know I'm no pro, but I'm better than he who knows nothing, so I'll teach what I do know.

su was just a precaution.

I wouldn't recommend learning a language and executing it under root privileges, there is a reason why most things require root access.
If you fuck up something it won't fuck up the whole system.

I might go a bit overboard, by saying you'll fuck up the whole system.
But if you're testing and running scripts you perhaps don't want them to have full system access.

Not necessarily speaking to you, but to others that might be learning something from the tutorials you write.
They might be stupid as fuck and run new scripts they get under root.