Linux Lite Forums

Development => Coding => Topic started by: bitsnpcs on October 23, 2014, 01:46:10 PM

Title: Beginning with Python
Post by: bitsnpcs on October 23, 2014, 01:46:10 PM
Hello,
there is a free online course for beginning with Python at Codecademy (http://www.codecademy.com/tracks/python).
It is done using their online editor.
Title: Re: Beginning with Python
Post by: Scott on October 23, 2014, 02:51:53 PM
Hi Bitsnpcs,
So, did you register? Are you going to take the course?
Title: Re: Beginning with Python
Post by: bitsnpcs on October 23, 2014, 08:49:01 PM
Hello Scott,

yes I registered there a while ago and have completed several other courses they do.

Yes I have begun the Python course.

Are you going to register and do the course or do you already know Python ?

It is possible to write your own course on there, or to write codebits which are standalone projects for others to practice and improve on things they have learned on a course.
Title: Re: Beginning with Python
Post by: Scott on October 23, 2014, 11:25:21 PM
 8) Way to go!

I am registered at Codecademy and their stuff is really nice but I think I'll leave the programming stuff for other people. Just don't enjoy it enought to pursue it but keep doing what you're doing because I'm sure Valtam could use another programmer on the tream.
Title: Re: Beginning with Python
Post by: bitsnpcs on October 24, 2014, 01:13:40 AM
I like their stuff too, it's a really good way to learn.

I am unsure what/where I will need to learn when I get to the stage of completing the beginner course to be of use to Valtam and the team.
I would like to help as soon as I am able enough :)
Title: Re: Beginning with Python
Post by: bitsnpcs on November 01, 2014, 08:08:08 PM
Hello,
I checked and these are the courses I have completed there in the past, HTML5, CSS3, javascript x2 courses (current and old one), Web Development stack, Markdown, and 3 of the beginner codebits.

Since beginning the Python course I noticed I had begun the jQuery course last year when I done the above courses and it was at 7%, I have done a bit more of that so it's at 24% now, but am trying to concentrate on learning the Python course for now, then I will finish off the jQuery, and try the Python API's for practice.

I found some extra things to do after the Python course to continue practicing and learning, one is a course in Full Circle magazine (assembled into 9 volumes of Special Issues), I noticed but haven't read (I need to try and finish the one course before beginning another one), this has info about creating a GUI for the project as well.

Program in Python vol.1 (http://dl.fullcirclemagazine.org/issuePY01_en.pdf)
Program in Python vol.2 (http://dl.fullcirclemagazine.org/issuePY02_en.pdf)
Program in Python vol.3 (http://dl.fullcirclemagazine.org/issuePY03_en.pdf)
Program in Python vol.4 (http://dl.fullcirclemagazine.org/issuePY04_en.pdf)
Program in Python vol.5 (http://dl.fullcirclemagazine.org/issuePY05_en.pdf)
Program in Python vol.6 (http://dl.fullcirclemagazine.org/issuePY06_en.pdf)
Program in Python vol.7 (http://dl.fullcirclemagazine.org/issuePY07_en.pdf)
Program in Python vol.8 (http://dl.fullcirclemagazine.org/issuePY08_en.pdf)
Program in Python vol.9 (http://dl.fullcirclemagazine.org/issuePY09_en.pdf)

Also on Codecademy forums I notice they recommend the course to follow on after their course as

Python the Hard Way (http://learnpythonthehardway.org/book/)

Which is available via link as a free html book, or to purchase with an included dvd of videos (which I've done).

The "Appendix A" is a -

Command Line Crash Course (http://learnpythonthehardway.org/book/appendixa.html)  for beginners.

So if anyone else is following the course hopefully this info might be useful for you also ?

As yet I have not looked into how to do the learning on the desktop, I noticed Python in gedit  menus, so it is possible to write it there, unsure how it's tested yet, and I noticed whilst browsing around online there is a way to do it in the CLI , but have not read the details yet.
Ideally it would be better to have a standalone method for testing so it (and any of my errors), doesn't cause problems in the OS.
Title: Re: Beginning with Python
Post by: Wirezfree on November 01, 2014, 08:14:04 PM
Ideally it would be better to have a standalone method for testing so it doesn't cause problems in the OS.

Hi,

I don't do coding...
Could you install Virtualbox and put an instance of LL in it to do your practice/testing.??
https://www.linuxliteos.com/forums/index.php?topic=388.0 (https://www.linuxliteos.com/forums/index.php?topic=388.0)

Dave
Title: Re: Beginning with Python
Post by: bitsnpcs on November 01, 2014, 10:13:23 PM
Hello Dave,

I am just a beginner/learning.
Thank you for your help and the information, I have bookmarked the link  :)
I haven't tried this before so it will be helpful.
I don't think I have enough RAM (1GB) on the LL computer, it is a P4 machine.
When I have a machine capable of it I will try this.

Hopefully I will have one soon more capable to try out new things.
Title: Re: Beginning with Python
Post by: Wirezfree on November 02, 2014, 02:22:47 PM
Hello Dave,

I am just a beginner/learning.
Thank you for your help and the information, I have bookmarked the link  :)
I haven't tried this before so it will be helpful.
I don't think I have enough RAM (1GB) on the LL computer, it is a P4 machine.
When I have a machine capable of it I will try this.

O.K,, Yes that would be pushing it.
Hopefully the newer PC will be a bit higher spec :)

Dave
Title: Re: Beginning with Python
Post by: bitsnpcs on November 02, 2014, 04:16:36 PM
Hello Dave,
yes hopefully so  :)





 
Title: Re: Beginning with Python
Post by: audiot3k on December 30, 2014, 02:52:48 AM
For those of you that have light development education check out this site for python learning.
http://learnpythonthehardway.org/book/
Title: Re: Beginning with Python
Post by: avj on February 15, 2015, 09:32:59 PM
This is the website I have been using to get started with Python, it is very hands on, and you don't have to download anything to get started.

http://cscircles.cemc.uwaterloo.ca/
Title: Re: Beginning with Python
Post by: bitsnpcs on February 16, 2015, 04:05:56 PM
Thank You avj. :)


Title: Re: Beginning with Python
Post by: avj on February 16, 2015, 04:12:47 PM
No problem.   :)
Title: Re: Beginning with Python
Post by: Hans on March 22, 2015, 04:42:24 AM
Hi All,

I've found this course on YT and I'm following it. So far, I think it's the most comprehensive python set of tutorials I've watched.

https://www.youtube.com/playlist?list=PL0845FEB57E5894C2 (https://www.youtube.com/playlist?list=PL0845FEB57E5894C2)
Title: Re: Beginning with Python
Post by: bitsnpcs on January 26, 2017, 08:21:23 PM
Thanks Hans  :)



Title: Re: Beginning with Python
Post by: bitsnpcs on February 11, 2017, 04:46:47 PM
Is the included Python in LL suitable full for learning with IDE, or is it for functionality in LL, and I need to download it ?

I am looking for newbie suitable recommendations of an IDE for Python, on Linux Lite, it will be -
 
1/ without too many panes.
2/ no auto complete, or it can be turned off. Indent is okay if it's not error prone.
3/ not white pane background, or has function to change this.
4/ can load projects to test within/internally, and provide error jump to code line, or log of project, or produce errors gui.

I am also looking for recommendation of nice gui creator for use with the above.
Title: Re: Beginning with Python
Post by: torreydale on February 12, 2017, 08:54:00 AM
I use Geany and Gedit.  I'd probably use Gedit exclusively because I like the Cobalt theme and I don't feel overwhelmed with features, but Gedit doesn't have column select.  Geany and Gedit are both available via the repository (ie. Install/Remove Software).
Title: Re: Beginning with Python
Post by: bitsnpcs on February 12, 2017, 11:27:56 AM
Thank you torreydale, :) I have installed Gedit, it sounds ideal in your description as I don't want to feel overwhelmed with features either.
Title: Re: Beginning with Python
Post by: torreydale on February 12, 2017, 11:47:18 AM
You don't need to download Python, by the way.  It is already installed with Linux Lite and most Unix based operating systems by default, including Mac.  All you have to do in Linux Lite is open a terminal and type in the word "python," and you'll be in the Python interpreter.  To run a python program, you type in python and the filename, eg. python test.py.  You have to be sure you either include the full directory path of the file or that you're running the command from the directory where that file resides.
Title: Re: Beginning with Python
Post by: bitsnpcs on February 12, 2017, 12:18:12 PM
I will save your instructions until I get used to doing this. :)

I have tried to install a theme "monokai-exteded (http://en.leoiannacone.com/2014/12/monokai-theme-for-gedit-gtksourceview/)" by adding it to this folder using copy/paste
 /usr/share/gtksourceview-3.0/styles/

When I right click inside the folder the menu option for paste is greyed out, how do I change this so I can add the theme ?
Will the theme still work if I change its filename before moving it has missing n.
Title: Re: Beginning with Python
Post by: LL-user on February 12, 2017, 05:18:23 PM
Hi bitsnpcs,

If you have a look at the ownership and permissions of the folder you want to write to, you'll see it's owned by root (the Linux name for the administrator) and only root has write permission. Therefore the menu option for paste is greyed out for any other user.

If you would like to copy/move the files there with your file manager, right click on the folder and choose "Open as Administrator".

Via command line:
Code: [Select]
sudo cp -va monokai-exteded /usr/share/gtksourceview-3.0/styles/assuming you run this command within the folder monokai-exteded is located in. Otherwise you need to hand over the path.

Hope that helps :)
Title: Re: Beginning with Python
Post by: bitsnpcs on February 12, 2017, 07:44:32 PM
Hello LL-user,
Thank you  :)

At the base of Gedit it has a menu, by default it reads "Plain text", are these colours a guideline set for the chosen input, or are they specific to the one chosen, eg; I want to use the colours for CSS setting on this theme for Python.
 
Title: Re: Beginning with Python
Post by: LL-user on February 12, 2017, 11:19:16 PM
You're welcome :)

Regarding gedit (I'm also using more and more instead of leafpad), sorry I don't get your question.
Here is some general info in the hope it provides you some answer. Otherwise let us know :)

[1] Syntax highlighting (https://help.gnome.org/users/gedit/stable/gedit-syntax-highlighting.html.en)

gedit provides syntax highlighting for a wide range of markup, programming, and scientific languages. If gedit recognizes the syntax being used when you open a file, it will automatically highlight the text.

If your syntax or language is not highlighted upon startup, you can select the appropriate syntax or language by clicking View ▸ Highlight Mode, and then choosing the desired syntax. Alternately, you can select the syntax name from a list at the bottom of the gedit window.

[2] How do I add a syntax highlighter format to Gedit? (https://askubuntu.com/questions/55494/how-do-i-add-a-syntax-highlighter-format-to-gedit)

[3] Create a custom syntax highlight in gedit (https://askubuntu.com/questions/473114/create-a-custom-syntax-highlight-in-gedit)

Hope that helps :)
Title: Re: Beginning with Python
Post by: bitsnpcs on February 13, 2017, 03:27:38 PM
Yes, it helps thank you  :)
Title: Re: Beginning with Python
Post by: bitsnpcs on February 21, 2017, 07:34:50 PM
I noticed in July 2017 the follow on book called - "Learn More Python the Hard Way - Zed Shaw" comes out, it is now available on Amazon pre-order, with a small discount of the price.


Title: Re: Beginning with Python
Post by: bitsnpcs on April 03, 2017, 11:40:17 AM
Hello,

for those using the book "Learn Python the Hard Way" I have found an error in the book.

Page 253 - Exercise 5 - Command Line Crash Course

Line 30 reads

cd ../../ ..

It needs to read

cd ../ ../ ../

I had tried the exercise 3 or 4 times and got an error in the terminal each time, eventually I cd back to home and began further on in the exercise, and where the cd ../ is used later to move up 7 levels with no error, after completing the exercise I then tried the line 30 adding the final / like is in the later part of the exercise, this command then didn't give an error.
I redone the entire exercise with that added to line 30 and there were no errors produced in the terminal.

So I think he has made a mistake, that you will need to add in the book a / to the end of line 30 to complete the exercise.

I am using the Third Edition.

If you found any errors when using the book, or find any errors as you work through the book please can you also add them in the thread to help each other.
Title: Re: Beginning with Python
Post by: bitsnpcs on April 14, 2017, 02:12:03 AM
I finished these 15 exercise now, other than the self learning in exercise 15 which I will use The Linux Command Line book for, 3 are covered in Chapter 9 and the first is covered in Chapter 17, being only on Chapter 4 its a long way off for me.

I didn't find any other errors as such.
But... exercise 13 -
he says to create a test2.txt then cat it, he does not say to type that contents in to the file so it will produce zero results, and will waste your time.
Better to cat test.txt to see the lines from previous exercise, he writes after exercise 13 in the "You learned this", also to cat test.txt and see the output from last exercise, it was the only way I managed to understand wtf he was on about.
Hopefully it will save someone not to waste their time also on exercise 13, and to read after the exercise ,what you have learned, before learning it, then you will actually be able to learn it etc.

The printed url for the Bash Cheat Sheet under title Unix Bash References is incorrect it has cli at the start of the url and this goes to the sales page not the free pdf.
This is the correct url (https://learncodethehardway.org/unix/bash_cheat_sheet.pdf)


I am hoping the Python chapters are of a better quality.

Update -
They are.
I have completed the Python exercise 0, 1, 2, and began 3, (before my available time ran out), his style of writing in the Python Chapters is very different to the command line course. It's extremely easy to follow and learn from. 8) (even for me)
Title: Re: Beginning with Python
Post by: bitsnpcs on April 15, 2017, 10:27:55 AM
I noticed a lot of people (and me too) have trouble with this one initially, so I decided to add it here to save people time so they can understand it sooner and continue the learning rather than get hung up on more advanced details if searching about it.

% - Modulus explained -

100-25*3%4
answer 97

Why -
25*3%4
25*3=75
75%4
answer 3

How it works -
75 divided into 4= 18 times
18x4=72
75-72= r3
%=3

Actual calculation at the final stage is -
100-3
so it is why the answer was 97


First of the ex3 explained

3+2+1-5+4%2-1/4+6

3+2+1=6
6-5=1
4%2=0  (4 divided into 2=2, zero remains, modulus %=0)
1+0=1
1/4=0 (1 cannot divide into 4 using whole numbers)
1-0=1
1+6=7
so it is why the answer was 7

I used Python calculating to work it out.
Just open python in terminal then trial error the various breakdowns until I understood what was happening.
Which was part of the #2 extra practices, so it also means can multi-task and 2 things at same time, if trying this.

I hope it helps someone else learning if they get stuck on modulus.