Python, where to start?

Chat about just about anything else
Post Reply
User avatar
Kibiras
Level 1
Level 1
Posts: 28
Joined: Sun Jan 20, 2019 11:21 am

Python, where to start?

Post by Kibiras » Wed Jan 23, 2019 3:01 am

Hello,

So I looking for what to learn new in my life.. And I found Python... I'm not sure, why this take my attention (I'm like new on programming), but it seems fun. And I don't know where to start? Any offers? I started basics on sololearn, but I think it should not be only one place from where I can learn something.
Image

User avatar
AndyMH
Level 9
Level 9
Posts: 2516
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Python, where to start?

Post by AndyMH » Wed Jan 23, 2019 4:20 am

I bought this to get me started:

https://www.amazon.co.uk/gp/product/159 ... UTF8&psc=1

Also install idle, can be installed from software manager. It's a simple IDE for python. It's not my favourite language.
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 3 x Thinkpad T430 Cinnamon 19.0, i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate

User avatar
Kibiras
Level 1
Level 1
Posts: 28
Joined: Sun Jan 20, 2019 11:21 am

Re: Python, where to start?

Post by Kibiras » Wed Jan 23, 2019 4:48 am

AndyMH wrote:
Wed Jan 23, 2019 4:20 am
I bought this to get me started:

https://www.amazon.co.uk/gp/product/159 ... UTF8&psc=1

Also install idle, can be installed from software manager. It's a simple IDE for python. It's not my favourite language.
You talking about Idle-python2.7? :)
Image

User avatar
AndyMH
Level 9
Level 9
Posts: 2516
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Python, where to start?

Post by AndyMH » Wed Jan 23, 2019 9:57 am

Everything I've done to date, which is not a lot, with python has been 2.7. I've got idle for version 3.6 installed as well as the 2.7 version, but not used it yet and haven't had any reason yet to find out what the differences are between 2.7 and 3.6.
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 3 x Thinkpad T430 Cinnamon 19.0, i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate

gm10
Level 19
Level 19
Posts: 9253
Joined: Thu Jun 21, 2018 5:11 pm

Re: Python, where to start?

Post by gm10 » Wed Jan 23, 2019 10:08 am

AndyMH wrote:
Wed Jan 23, 2019 9:57 am
Everything I've done to date with python has been 2.7. I've got version 3 installed but not used it explicitly
python2 is over a decade old and is already on extended life support, which will finally run out by the end of the year. You shouldn't be using it unless you have to.

PS: https://www.python.org/dev/peps/pep-0373/

User avatar
xenopeek
Level 24
Level 24
Posts: 24099
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Python, where to start?

Post by xenopeek » Wed Jan 23, 2019 10:20 am

I'd suggest the Hitchhiker's Guide to Python: https://docs.python-guide.org/index.html. You can read it online or get the book. The official Python documentation can also be useful reference: https://docs.python.org/3/.

And indeed, go for Python 3 and skip anything that's about Python 2 because that's dead.

I like AndyMH's suggestion. The publisher of that book has other books on Python that might be interesting depending on what you want to do with Python.

You learn easiest when you also practice. So go write some programs. Whether they are practical or silly doesn't matter as long as you're exercising your programming skills. Automating things is a good place to start.
Image

User avatar
Kibiras
Level 1
Level 1
Posts: 28
Joined: Sun Jan 20, 2019 11:21 am

Re: Python, where to start?

Post by Kibiras » Wed Jan 23, 2019 11:46 am

xenopeek wrote:
Wed Jan 23, 2019 10:20 am
I'd suggest the Hitchhiker's Guide to Python: https://docs.python-guide.org/index.html. You can read it online or get the book. The official Python documentation can also be useful reference: https://docs.python.org/3/.

And indeed, go for Python 3 and skip anything that's about Python 2 because that's dead.

I like AndyMH's suggestion. The publisher of that book has other books on Python that might be interesting depending on what you want to do with Python.

You learn easiest when you also practice. So go write some programs. Whether they are practical or silly doesn't matter as long as you're exercising your programming skills. Automating things is a good place to start.
But where to download something to write programs on Linux? And still I need basics about Python, so I'm learning from SoloLearn CPython, but there is nothing talking about versions :). And thank you for answers!
Image

User avatar
xenopeek
Level 24
Level 24
Posts: 24099
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Python, where to start?

Post by xenopeek » Wed Jan 23, 2019 12:28 pm

You don't need to download or install anything. Python 3 is already installed on your system and you can just use the Text Editor (xed) you'll find in your menu to write simple programs. When you open an existing Python program with Text Editor it will do syntax highlighting for you. For new, blank, files you can toggle Python syntax highlighting by selecting that at the bottom of the window (click on "Plain Text ⏷").

For example put these lines in a file and save it (the first line is special and makes Linux know this is a Python 3 program):

Code: Select all

#!/usr/bin/python3

print("Hello, World!")
This program you can run from the terminal. Let's assume you saved it as "sayhello" in your Documents directory. Open the terminal from your menu and change directory (cd) to the directory where you put the file, so in this example with command:
cd Documents
Then you can execute your program by running:
python3 sayhello
You can also make your program executable with command chmod +x sayhello or by right-clicking the file in your file manager, select Properties and then on the Permissions tab enable to allow executing it. After making the program executable you can run it on the terminal as:
./sayhello

What I personally did was put a file called "Python 3" with only the line #!/usr/bin/python3 in it, and having made it executable, in my Templates directory. That way when you right-click in a directory you can select Create New Document > Python 3 from the context menu to quickly create a new Python 3 executable file for you to start editing.

You can also run Python 3 interactively with the command python3 on the terminal. It gives you a new prompt and any Python 3 code you type here is executed immediately. Can be useful for trying things out or accessing builtin help (like help(print) will explain print). Type print("Hello, World!") to be surprised :) Type quit() to exit.

Depending on your likes and needs a plain text editor will suffice for programming but you may prefer a generic programmer's editor (like Geany) or an IDE that supports Python (like IDLE mentioned above, but make sure to install idle3).
Image

User avatar
Kibiras
Level 1
Level 1
Posts: 28
Joined: Sun Jan 20, 2019 11:21 am

Re: Python, where to start?

Post by Kibiras » Wed Jan 23, 2019 12:53 pm

xenopeek wrote:
Wed Jan 23, 2019 12:28 pm
You don't need to download or install anything. Python 3 is already installed on your system and you can just use the Text Editor (xed) you'll find in your menu to write simple programs. When you open an existing Python program with Text Editor it will do syntax highlighting for you. For new, blank, files you can toggle Python syntax highlighting by selecting that at the bottom of the window (click on "Plain Text ⏷").

For example put these lines in a file and save it (the first line is special and makes Linux know this is a Python 3 program):

Code: Select all

#!/usr/bin/python3

print("Hello, World!")
This program you can run from the terminal. Let's assume you saved it as "sayhello" in your Documents directory. Open the terminal from your menu and change directory (cd) to the directory where you put the file, so in this example with command:
cd Documents
Then you can execute your program by running:
python3 sayhello
You can also make your program executable with command chmod +x sayhello or by right-clicking the file in your file manager, select Properties and then on the Permissions tab enable to allow executing it. After making the program executable you can run it on the terminal as:
./sayhello

What I personally did was put a file called "Python 3" with only the line #!/usr/bin/python3 in it, and having made it executable, in my Templates directory. That way when you right-click in a directory you can select Create New Document > Python 3 from the context menu to quickly create a new Python 3 executable file for you to start editing.

You can also run Python 3 interactively with the command python3 on the terminal. It gives you a new prompt and any Python 3 code you type here is executed immediately. Can be useful for trying things out or accessing builtin help (like help(print) will explain print). Type print("Hello, World!") to be surprised :) Type quit() to exit.

Depending on your likes and needs a plain text editor will suffice for programming but you may prefer a generic programmer's editor (like Geany) or an IDE that supports Python (like IDLE mentioned above, but make sure to install idle3).
Thanks, I'll try many ways :). What about if I want to create a program? Like where I can input and read lines and other? Smth like .exe file from windows? What should I use?
Image

User avatar
xenopeek
Level 24
Level 24
Posts: 24099
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Python, where to start?

Post by xenopeek » Wed Jan 23, 2019 12:58 pm

Python is a scripted language, you run the text files. You don't need to compile it to a binary file (like .exe on Windows).
Image

User avatar
Kibiras
Level 1
Level 1
Posts: 28
Joined: Sun Jan 20, 2019 11:21 am

Re: Python, where to start?

Post by Kibiras » Wed Jan 23, 2019 1:03 pm

xenopeek wrote:
Wed Jan 23, 2019 12:58 pm
Python is a scripted language, you run the text files. You don't need to compile it to a binary file (like .exe on Windows).
So with Python I can't create forms like with C#? :/

I mean create a program with graphical design.
Image

User avatar
AndyMH
Level 9
Level 9
Posts: 2516
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Python, where to start?

Post by AndyMH » Wed Jan 23, 2019 2:22 pm

I mean create a program with graphical design.
https://opensource.com/resources/python/gui-frameworks

It is very easy to google!
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 3 x Thinkpad T430 Cinnamon 19.0, i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate

User avatar
xenopeek
Level 24
Level 24
Posts: 24099
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Python, where to start?

Post by xenopeek » Wed Jan 23, 2019 2:27 pm

You'd use a widget toolkit, like Gtk or Qt. There's user interface designers for both and libraries you can also use from Python. On Linux Mint most programs use Gtk but programs like VLC use Qt and all KDE programs use Qt.

Here is a tutorial on using Gtk with Python 3: https://python-gtk-3-tutorial.readthedocs.io/en/latest/. You can use Glade for user interface design (you can also make user interfaces progammatically or by hand writing the user interface definition file, both also covered in the previous link). Another option is to install GNOME Builder, an expansive IDE for programming for Gnome / Gtk which also comes with full Python support.

I don't have much experience with Qt but their IDE is called Qt Creator and I assume from https://www.qt.io/qt-for-python that it also has support for Python nowadays.
Image

User avatar
Kibiras
Level 1
Level 1
Posts: 28
Joined: Sun Jan 20, 2019 11:21 am

Re: Python, where to start?

Post by Kibiras » Wed Jan 23, 2019 2:30 pm

xenopeek wrote:
Wed Jan 23, 2019 2:27 pm
You'd use a widget toolkit, like Gtk or Qt. There's user interface designers for both and libraries you can also use from Python. On Linux Mint most programs use Gtk but programs like VLC use Qt and all KDE programs use Qt.

Here is a tutorial on using Gtk with Python 3: https://python-gtk-3-tutorial.readthedocs.io/en/latest/. You can use Glade for user interface design (you can also make user interfaces progammatically or by hand writing the user interface definition file, both also covered in the previous link). Another option is to install GNOME Builder, an expansive IDE for programming for Gnome / Gtk which also comes with full Python support.

I don't have much experience with Qt but their IDE is called Qt Creator and I assume from https://www.qt.io/qt-for-python that it also has support for Python nowadays.
Wow.. Su much information.. I'm very thank you :D. +REP :). You helped me a lot. Now let's go and study all the information :). Thank you again!
Image

User avatar
xenopeek
Level 24
Level 24
Posts: 24099
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Python, where to start?

Post by xenopeek » Wed Jan 23, 2019 3:14 pm

You're welcome. Have fun with it :mrgreen:
Image

User avatar
Kibiras
Level 1
Level 1
Posts: 28
Joined: Sun Jan 20, 2019 11:21 am

Re: Python, where to start?

Post by Kibiras » Wed Jan 23, 2019 3:20 pm

xenopeek wrote:
Wed Jan 23, 2019 3:14 pm
You're welcome. Have fun with it :mrgreen:
I will! My little new project will be for tv series list, where you can add tv series name, series count, and check when you done watching series, seasons or etc. :). I don't know how I will make it, but I will :D.
Image

User avatar
xenopeek
Level 24
Level 24
Posts: 24099
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Python, where to start?

Post by xenopeek » Wed Jan 23, 2019 3:42 pm

You might find use for the IMDB datasets you can download from https://www.imdb.com/interfaces/ for that. That way you could let users add a TV series by typing the name in a search field and your program would find the episodes list and titles itself. Anyway, just daydreaming—this is the perfect example of things you should postpone till you have a basic program running.
Image

gm10
Level 19
Level 19
Posts: 9253
Joined: Thu Jun 21, 2018 5:11 pm

Re: Python, where to start?

Post by gm10 » Wed Jan 23, 2019 3:52 pm

Kibiras wrote:
Wed Jan 23, 2019 3:20 pm
I don't know how I will make it, but I will :D.
There's a ton of apps and websites that already do this. By no means does this mean you shouldn't try coding your own, after all coding is fun, only mentioning it in case you didn't know.

User avatar
MrEen
Level 14
Level 14
Posts: 5079
Joined: Mon Jun 12, 2017 8:39 pm

Re: Python, where to start?

Post by MrEen » Wed Jan 23, 2019 4:28 pm

Just wanted to add my thanks to all the contributors to this thread. I've been debating jumping into Python and there are some great ideas here for getting started.

Thanks also to Kibiras for asking this question. Hopefully this thread kicks me into gear on getting started myself!

User avatar
Kibiras
Level 1
Level 1
Posts: 28
Joined: Sun Jan 20, 2019 11:21 am

Re: Python, where to start?

Post by Kibiras » Thu Jan 24, 2019 3:10 am

xenopeek wrote:
Wed Jan 23, 2019 3:42 pm
You might find use for the IMDB datasets you can download from https://www.imdb.com/interfaces/ for that. That way you could let users add a TV series by typing the name in a search field and your program would find the episodes list and titles itself. Anyway, just daydreaming—this is the perfect example of things you should postpone till you have a basic program running.
Thank you. Yeah, for now daydreaming is that I want to create this program only in text editor with no graphics.. Only with inputs, save system and other some features... :D
gm10 wrote:
Wed Jan 23, 2019 3:52 pm
Kibiras wrote:
Wed Jan 23, 2019 3:20 pm
I don't know how I will make it, but I will :D.
There's a ton of apps and websites that already do this. By no means does this mean you shouldn't try coding your own, after all coding is fun, only mentioning it in case you didn't know.
I need to create my own :D.
MrEen wrote:
Wed Jan 23, 2019 4:28 pm
Just wanted to add my thanks to all the contributors to this thread. I've been debating jumping into Python and there are some great ideas here for getting started.

Thanks also to Kibiras for asking this question. Hopefully this thread kicks me into gear on getting started myself!
It's good feeling when asking help and at the same I helping for other :D
Image

Post Reply

Return to “Open chat”