Python Tutorials For Users Of Linux Mint Debian Edition 3 Cindy 64bit

RonaldQuilao
  7 months ago
  -1

PYTHON 3.5 (Cpython) TUTORIAL FOR ABSOLUTE BEGINNERS

Good Day! Fellow Linux Mint Debian Edition 3 Users :) This is Part 1 of a series of tutorials that i will share here with python programming. i will continue to upload more, and Share More as i progress with my Python Skill.

At the time of this writing, the Python version that my computer is using, is Python 3.5 (This is default for LMDE 3 can't speak for Other distro's..)

So before we get started, let's first prepare everything that we will need
for this. there's just two at the moment that i know is needed.

REQUIREMENTS:
1.) Python 3.5 (Ofcourse) (This is Installed By Default On Your LMDE 3)
2.) Integrated Development Environment or IDE (There are many options for this, you can choose between IDLE, Erick, Pycharm etc etc..)

For Python 3.5, you already have this, but this is not shown on your menu by
default. if you don't see it on your menu, then, right-click on your menu, button, click "configure", a new window will pop-up showing two tabs (panel, menu), choose "menu" tab then click the button that says "open the menu editor". after that, on the leftmost panel, click "Programming". afterwards, you will see "Python 3.5" on the right pane. check the tick box for it, then click "close" button on the lower right of that window. and finally, close all other windows.

Now, check your menu again, you should be able to access the Python 3.5 Terminal from your menu, it should show there now. but that is not enough, it's hard to Create Python Scripts with just the Python Terminal Alone so we're still gonna need to install a Python IDE. let's go check our Software Center then! :)

From the Software Center, Just Search and Choose Whatever IDE works for you. as for me, who is also a complete newbie on this, i went and Install "IDLE 3.5" it's a lot easier for me, and it also supports syntax highlighting, which is very important as you'll later find out as we progress.

Let's Get Started-TERMINOLOGIES FIRST :)

First of all let's get ourselves acquainted with a few "Basic" vocabularies related to Python 3.5

1.) Comment =
this is the sign, symbol that python is using for comments "#". (some call it pound, other's call it hash tag! as for me, a millenial, i tend to sitck with pound! :P this is my tutorial so i win haha :) comments are not part of the actual commands that will be executed in your script. but this is extremely useful for the actual programmer like you and me in maintaining our code. comments can be used to add little information about what a particular part of our script is doing.

2.) Syntax = A term that i rarely hear these days, you can think of this as like a grammar rule. the best analogy is when you are writing a sentence for example, in the english language, you have to make sure that your words, spelling, subject and verb agreement fall into the right place to make sure your sentence becomes meaningful and understandable for the people you're talking to.

In Computer, Syntax refers to the order, sequence of how arguments and options for a specific command should be written in a script. (just like with how you organize your words in sentences) it is interesting that just like rules for spelling of words in english, in programming, spelling is also important. a misspelled command will not work. and a wrong syntax will also not work. in a nutshell wrong syntax means the computer will not understand what you're telling it to do :)

3.) IDLE = Integrated Development Environment. you can think of this as a software program that you can use to create programming scripts. there are so many different IDE's out there for different programming languages. IDLE is just one of them. some people prefer Pycharm, Bluefish, Erick IDE. in the end, it's all about what works for you. some IDE have support for Multiple Programming Languages. which is what people who do a lot of programming in different languages are after for. (I am personally Using IDLE 3.5)

4.) And Lastly, there is some long term benefits of knowing and expanding your programming vocabulary with the terms and technical jargons. trust me on this, there will come a time that you will eventually be reading other articles sources, and having ourselves already become familiar with this terms could help us relate and understand other technical writings, publications :)

Alright, that's enough for the introductory part. let's get to programming.

The first thing that were gonna discuss here is about how you can create a Python script that will allow you to display a text to your user. for this we have the print command that can do the job! :) examine the sample script below. much better if you can start trying this out on your python to see how each of these commands work. and like what i've mentioned earlier. every command has a syntax.

For "print" command, the syntax is the command itself, "print" and then the pair of "( )" parenthesis. and inside the parenthesis is where we would put the text / message that we would want to display to our users. as you can see, part of the syntax is enclosing the message within quotes.

 #This Is A Comment
print("Welcome To Python Programming!")

As you can see from the above syntax, the python IDLE color codes everything! To make it easier for you to see which one is a comment, which one is a command or a reserved word. The code above, when executed from the python terminal will print or display a message to our program users a simple greeting. “Welcome To Python Programming”

let's take another example..this time i'll be using the comment more to explain
what a particular block of code or script does. so you can get used with comments

#This Particular Block Of Script Will Prompt Users
#For Their Name.
print("What Is Your Name? ")

There are three 3 ways that i know so far that will let you display text in multipe lines
1. use multiple print statements
2. use the \n escape sequence.
3. Use some hack :)

<style type="text/css"> p { margin-bottom: 0.25cm; line-height: 115%; background: transparent none repeat scroll 0% 0%; } </style>

#This Is The Method 1 that I am Talking About. Using
#Multiple Print Statements To Print Multiple Lines Of Text

print("This Is The First Line Of Text")
print("This Is The Second Line Of Text")
print("This Is The Third Line Of Text")


#This Is Method 2 using the escape sequence "\n"
#To Span Lines Of Text In Multiple Lines

print("This Is The First Line\nThis Is The Second Line")

#This Is The Method 3. Uses The Triple Quotes Method To Display
#Multiple Lines Of Text

#Text is Shown Exactly The Way You Have It Typed On Your Script
print("""This Is The First Line
This Is The Second Line
This Is The Third Line"""
)

Alright That's it for now. keep practicing and as you practice, you will find that syntax will become a second nature to you. :) will be uploading more on How we can use python to create apps for linux mint. we'll do this in gradual steps

Comments
justoneprimate 6 months ago

Not to mention this is plain wrong...
#This Particular Block Of Script Will Prompt Users
#For Their Name.
print("What Is Your Name? ")

The correct code would be:
name = input("What is your name?")
print("Hello {}".format(name)




RonaldQuilao 7 months ago

I believe this tutorial is still somehow related to linux mint as i detailed some steps here on how they can make use of software manager to install IDLE and enable Python Terminal for this specific version of mint. which i believe is a core part of this linux mint distro.


remoulder 7 months ago

This is not relevant to Linuxmint, programming can be done on any OS, and they are scores of beginners websites and tutorials available for anyone wanting to learn. This is a place for tutorials about the linuxmint distro.