Loops on Python

Hello everybody in this lesion we are going to talk about for and while loop. Ok  loop are used if we want to repeat our code.In this case we are not going to write the same codes a lot of times but we have to use loops.We use for to repeat our codes for example 8 times to do this we use a code called range, and we use while True to repeat our codes forever.We can use while True for creating programs that not will be closed when are executed the codes at the end of the line.

for i in range(12): #It will repeat the code on it 12 times

print(This output will be repeated 12 times”)

while True:

print(“This program will be executed forever”)

Thanks for reading!! I will see you in the next lesion

Conditional using Python

Hello to everyone here we have another lesion on Python. I’am today are going to talk about Conditional. So in Python we have three type of Conditional. The first is “if“, that is the first condition used on Python. For the rest of condition   “elif”   or “else” .

ans=input(Is your birthday? (y/n)”#The program is asking about your birthday 

if   ans==“y”# if is the first condition that we use on python! If the user input is y

             print(“Happy birthday!!” #the output is “Happy birthday!!”

elif ans==“n”#When the input is not predicted in  if ,we use elif (for another possible                 print(“When is your birthday?”)                                                                            input)

else:                         #We use else for including all other possible inputs

print(“Sorry i didn’t  get that!”)

 

           

Basic code

Hello everybody now you are going to learn your first code on python.Hope you like it!!

Have fun!! Let’s start our first programming hour!!

screenshot_2016-09-11-13-08-08-1

As you see in the photo this is a simple code.The syntax print()   is used to output the value inside the “”.You can write anything you want but you have to be careful for “” or ” but is incorrect if you “‘.Be careful to write the code exactly because the  python idle will make an error.

You can also create  variables .Variables are hmm let’s say a  new code that help us to define something,for example:

my_name=“John”

print(my_name) #output is John

be careful because the space will replace with “.I am going to show you another example of variables for example

a=“My name is John”

b=a

print(b) #output is “My name is John”

An other example of variables is :

a=4

b=5

result=a+b

print(result) # output is 9

Now we are going to request the user for getting the input.The syntax for making this is input().But we have to create a variable for defining.For example:

name=input(“Enter your name:”)#output “Enter your name:”,this is to say to user what he have to do

print(name)#output is the input name

Ok this were some basic code for more we are going to talk in the other lesion.I hope this course have helped you to learn something about python.

 

Editor vs Shell

Ok everybody now we are going to see the difference between shell and editor. Editor is  good for writing  a good program ,because you can save and edit it.In case you are tired or want to write later Editor is perfect.If you want to run something rough is more easier with Editor.Shell  is different by Editor.In shell you can write code for testing if the program can run.But you can’t save or edit it.In the other lesion we are going to use editor.If you haven’t download python idle here is the link with the instruction https://thecomputerworldblog.wordpress.com/2016/09/11/how-to-install-python-idle/.

How to install python idle?

Ok first of all visit this link https://www.python.org/downloads/windows , here you are going to download python 3.6.0a2. I am recommend this because i have no experience with other version such as python 3.6.0a3 or python 3.6.0a4. This is important,for example python 3.5.2 have problem with the module socket(I’am going to explain to you in the next lesions),as result you couldn’t use your python idle for creating any new program,the same problem might be with the higher version of python. 3.6.0a2 has not this  problems.I don’t recommend to you the lowest version like python 2.Python 3 is more easier to use.Python programming is more easier than any other language because has simple syntax.For more in the next lesion.

Why Python?

Before i go to explain to you why i chose Python,lets see what Python is.
So,Python is was conceived in the late 1980s, and its implementation began in December 1989 by Guido van Rossum at Centrum Wiskunde & Informatica in the Netherlands as a successor to the ABC language capable of exception handling and interfacing with the operating system Amoeba.Van Rossum is Python’s principal author, and his continuing central role in deciding the direction of Python is reflected in the title given to him by the Python community, benevolent dictator for life (BDFL).Python is a widely used high-level, general-purpose, interpreted, dynamic programming language.Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java.The language provides constructs intended to enable writing clear programs on both a small and large scale.For more we are going to talk in the other lesions.