Skip to main content

Introduction To Python

Introduction To Python

   Hello everyone and welcome to this amazing introductory lesson on python. If you are new to this platform, please do check out our previous lessons. If you are new in python, then this guide has been composed specifically for you (beginners and newbies) as you will be taken through your very first program.  Hence, if you’re one, then kindly go through the lesson till the end.

In this lesson, we will discuss the following

  • Getting started with python (what is python)
  • Installation and setup of python
  • First hello world code of python

Getting started with python (what is python)
Python is a high-level programming language which was created in 1991 by Guido Van Rossum. Python is very simple and easy to learn (master). Due to its syntax, programmers are able enough to express concepts in fewer lines of code. Python communicates its intention to the reader (readable). With pythons you can create your own games and programs, complex commercial applications, web development (which uses django web frameworks, pyramid, web2py, Grok, and Turbo Gears web frameworks which are based on python programming), data analysis, machine learning, prototyping and many more. It is among the few programming languages that work with other coding languages and allows cross-platform that work with every operating system such as windows, MacOS, Linux.

Installation of python
Python installation is just a matter of few of steps. The latest version of Python is always available; however, any release can be downloaded for any operating system. Visit this site https://www.python.org/downloads/ and select the best downloading option for your operating system.

  • Windows

  1. Download Python for windows by clicking the yellow block. The file name appears as python-3.9.0.exe (depending on the version you are downloading).

Introduction To Python

  1. Open the file, a popup window will appear. Click run.

Introduction To Python
  1. A window will appear for installation. Do you want to install Python? Click on install button.

Introduction To Python

  1. It will require an additional space of the disk space after installation. So, make sure you select a path with enough free space.

  2. After browsing the path where the Python will install, click on the install button and installation will start.

Introduction To Python

  1. The setup completes.

Introduction To Python


  • Mac OS X and linux

Most recent version of linux and python already has python installed in them. . However, if the already installed python is out of date, you can update it to the latest version of Python. Visit the same website as above https://www.python.org/downloads/ and download Python for your operating system. Follow the easy steps to install the python on your operating system

How to run python.

Before we start running our first Python program, it is important that we understand how we can run python programs. This simply means that we are making the computer process instructions/lines of codes.

  • Immediate Mode

It is a way of running python programs that are not written in a file. We enter the immediate mode by typing the word python or py in the command line and which will instruct the interpreter to change into immediate mode. The immediate mode allows typing of expressions directly, and pressing enter generates the output. The sign below is the Python prompt:

>>>

  • Script Mode

The script mode is used to process python information found in a file; the file is called a script.

  • Integrated Development Environment (IDE)

An IDE provides a better way of writing and running Python programs. Some of the advantages of IDE include helping in removing repetitive work and simplify coding for beginners

First hello world code of python

Hello World is the most simple program you will ever write, but it is also the first program you will ever write in Python (or ever, if you have never programmed before). So get excited!

Start IDLE

 

Introduction To Python

  1. Once you click on the python IDLE, you will see the shell screen

Introduction To Python


  1. Go to the File menu and click file

Introduction To Python

  1. Type in the following sentence in the shell screen

>>>print (“Hello World”)
  1. On the file, menu click on Save As. Type the name of my first Program1.py

Introduction To Python

  1. Go Run(found at the top of the python shell) and click Run to run the program.

The result (output) of the statement written above is program is hello world”.  

Introduction To Python

Explanation

Here is what has happened, the Print () is an inbuilt function, it is prewritten and preloaded for you and is used to display whatever is contained in the () as long as it is between the double quotes. The computer will display anything written within the double quotes.

Practice the following 

a)    print(“I am now a Python Language programmer!”)

b)     print(“python programming is really cool!”)

c)      print(“I want to study web programming”)

To conclude, there are other alternatives in getting started with python which can be to create a file with extension .py from any text editor and then running the command python name_of_file.py on the console.

Thanks.

Comments

Popular posts from this blog

Introduction to flask

Hello. Welcome to another session on this platform. If you are new here, please do checkout our previous articles on python programming language and stay excited on this session because we are entering into one of python’s web-based application called flask. In this article, we are going to see the following What is flask Prequistes Installation of flask in python Some of flask template engine. What is flask? Flask is one of python-based framework which is used to create web applications. Flight is a very light web framework. During installation, flask comes with pre-installed modules and functions which are used to backup your own web applications. Flask is very easy to understand and perfect go-to for beginners and with flask, a web server can run in less than 3 lines of code. Prequistes Before learning flask, we recommend the reader to have a basic mastery of python concepts. Installation of flask  Before installing flask, we have to checked if python has been installed or. If n...

How to generate random numbers using NumP1

Hello. Welcome to another edition on this platform. For more better understanding, do checkout our YouTube channel to get the video tutorial. In this article of today, we are going to see how to generate random numbers using any of the following methods: Generating a random number Generating a random float and integer Generating random number arrays Generating random number from an array What is a random number? This is a number which cannot be predicted before its occurrence. This number might not different every time. Programmatically, they are two categories of random numbers:     Pseudo-Random numbers       True Random numbers. Just as programs which are written by programmers are a set of instructions, we must follow an algorithm to generate random numbers. Random numbers which are generated using an algorithm are called Pseudo-Random numbers. To generate a true random number, it is important to get the data from sources such as the keyboards, mou...

Introduction to Django

Hello. Welcome to another session on this platform. If you are new here, please do checkout our previous articles on python programming language and stay excited on this session. we are entering into one of python’s application called Django. In this article, we are going to discuss the following: What is Django Why must we use Django  A brief history of Django Installation of Django Popularity of Django What is Django? Python has so many framework application and Django happen to be one of them. Being a python-based-framework, it is used to quickly create web applications.  When building websites, django provides similar ready-made components to handle user authentication, forms, a way to upload components. Why use django? Django is very fast. It takes applications from concept to applications very quickly Django has thousand available packages in it when it is installed. With django, we can launch web applications is a matter of hours. Django is a highly is secured and helps...