La Boina Roja

Linux, the struggles are real!

Leave a comment

How to make typing along with Python tutorials easier.

A lot of youtube vids use IDLE in their tutorial, there is absolutely nothing wrong with that. In matter of fact, it makes typing along easier if you use IDLE too, but situations like in the picture below piss me off photo piangry.gif!


I prefer this  photo shiny.gif it saves me the hassle of changing screens.


So what happened in the second picture? Well, I used Python’s built in interpreter which you can open by simply typing python in the terminal. Look:


And I made the terminal’s background color transparent by changing it’s transparency. You do this by

Edit > Preferences


The following screen will appear, select the tab Appearance, in this tab you can change the transparency settings.


If you are finished with the interpreter but have other stuff to do in terminal, all you have to do is press CTRL d and the interpreter will close and you can do whatever you need to do in terminal.


(Yes, another se7en  photo heart.gif!)

(Remember, you can always do the cliccie for larger piccie photo puh2.gif)

Leave a comment

If, elif and else explained

The credits for this explanation all go to zlozlozlozlozlozlo a user at reddit. I thought his explanation is worth sharing with you guys null

The if-if-else chain
if A:
>>>do_foo # this gest executed if A evaluates to True
if B:
>>>do_bar #this gest executed if B evaluates to True (regardless of A)
>>>do_baz #this gets executed if B doesn't evaluate to True (again, regardless of A)

The if-elif-else chain:

if A:
>>>do_foo #this gest executed if A evaluates to True
elif B:
>>>do_bar #this gets executed if A doesn't evaluate to True but B does
>>>do_baz # this gest executed if neiter A or B evaluaes to True

Only one of the three is executed in the above if-elif-else chain.

If you need more explanation null there are more people who also did a great job explaining this to me here.

Leave a comment

Recommendation: The Art and Craft of Programming: Python Edition

Free e book written by John C. Lutsh available in HTML and PDF format, this book will not teach you to program. You will learn about how and why things work the way they do in Python on a basic level.

This is a well written starters guide, the PDF file is about 138 pages long. The writer is very novice friendly he, bothers to explain what precedence is for example. He does this in very a efficient and effective way, I personally liked how he explained assignments

cliccie for larger piccie

I myself will not go through the entire book from beginning to end, but seeing how he explains basic things rather well, I will use this book as a reference guide. That is another beauty of this book, it is written so well you only can go through the for you  relevant chapters. Without worrying whether you should have read the chapters before it or not. He should add a search function on the HTML version of the book though null

He has some small exercises in the book, with (thank God null) the answers.

The book is about Python 3, but since the writer is teaching you about concepts in Python,  you can use this book for Python 2 too.