Python programming language


 This cousse will tech us the basics and advance concept of python programming languages.

  • Python prequisites:
What do you need before learning python?

1. Computer literacy.
2. Knowledge of installing a software.
3. A compiler.

Tip! Python is easy and fun to learn.

* Much easier with examples:- 
This course contains hundred of examples, this feature makes learning python much easier, faster and enjoyable.

* Python is easy:-
To learn python, you don't need any priod knowledge or experience on programming. 
   Python is human readable, making it easier to understand.
   Take a look at this Exampled:-

    X=4 
    Y=3
    Sum=x+y
    Print (sum)

Although we have not taught you how to code python yet, you can still easily pick up that.

1. X is 4.
2. Y is 3.
3. Sum is the addition of x and y and.
4. Sum will be printed on the screen.
          
                What is python?

Python is a programming language, python is one of the most popular programming languages.

                Who created python?

Python was created by Guido Van Rossum and it was first implemted in 1989.
        
             What is python used for? 

Python is used for:-

1. Web Development.
2. Machine learning.
3. Data science.
4. Scripting.
5. And many more.

           What is the latest version of python

Python 3 is currently the latest version of python, this toturial is based on the standards of python 3.
       
            Where can code python?

You can code python using compiler or online interpreter that is best suited for learning.
    And of course you can also code python on your PC.

                   Installing python

Before you can run python in your PC, you need to install it first.
    To install in a PC, go to 
https://www.python.org/downloads/ then download the latest version.
     After download, install it just like how you install other apps.
     Make sure that you check "Add python 3.8 to PATH" for easier installation.
    You can now run python code on your PC, you will learn how to do so in this topic.

      Python interpreter (compiler)

A python interpreter (compiler) is a program that exucute python codes.
        
              Writing python codes

In order to learn python, you need to be able to write and exucute codes.
      In this topic, you will learn where to write python codes and how to exucute them.

              Python console (shell)

Python console also known as shell, allows you to exucute python codes line by line.
     Assuming that you have already installed python on your PC, you can access the python console by opening the command prompt and by typing python.
     Let's start using the console.
     Type the following and hit enter.
  
  Name= "mustapha sunusi tahir" 
      Again, type the following and hit enter.
  
  Print (name)
    After that you should see this:-

    Mustapha Sunusi Tahir

  Notice that you hit enter after written a line by line of codes, it is because the python console exucutes code line by line.

                      Python files

Python files are saved with the .py file
extension.
     You can use any text editor (even notepad) to create python files.
     Just make sure that you save them with the .py extension, for example hello.py.
      To run this python file on a PC, navigate to the folder where it is located using the command prompt.
      Then type the following and hit enter.
     
     Python hello.py
  
    The console should then  output:- 
  
     Hello world!
  
                 Python interpreter

A python interpreter or compiler is a program that exucutes python codes directly.
      It is best to used where practicing to codes python.
     
                  Saving python files

This topic explain to you, how can you saved your python files.
        You will saved it as (hello.py) file name.

   Note! You can name the file anyway you like as long as the file extension is (.py).

              Opening python files

You will open the python files by click "open" and located where you saved your python file and click it.
   
           Python displaying output

To displaying an output in Python, use the print () function.

                       Printing text

The print () function can be used to print a string (text).
     In this example, the Hello world! text will be printed.
  
   Print ("Hello world!)

                 Printing number

The print () function can be used to print numbers.
      In this example, 21 will be printed. 
   
   Print (21)

        You can also print the addition of the numbers.
   
    Print (3+12)

       You can also use the print () function to print other data types.
 
  Tip! You will learn the different data types as you go through the topics

              Printing two objects

The print () function can also be used to print two objects.
    In this examples, will print two text at once.

      Print ("Hello" , "world")
 
  In this example, will print a string and the sum of two numbers.

   X=3
   Y=21
  Sum=x+y
  Print ("the sum is" , sum)

                  Python statement

A python statement is commanly used to write a value, compute a value, assign a value to a variable, call a function any many more.
 
  Example:-
In this example, we have 3 line of codes.
   In pyPyth, each line typically contains one statement.
 
  X=4
  Y=3
  Print (x+y)

  In the example above, the first statement assign number 4 to the x variable.
    The second statement assign number 3 to the y variable.
    The third statement print the addition of x and y. 

     Multiple statements in one line

You can also write multiple statements in a single line of code.
     Simple separate the statement with semicolons (;).

  X=4; Y=3; print (x+y)

     One statement in multiple lines

There are also some cases where you can write a string statement in multiple lines.
      One example is when you assign a list to a variable.
 
    Fruit=["Orange",
               "Mango"
               " Banana"]







 




            

Comments

Post a Comment

Popular Posts