Python Introduction




Python language—Python is a popular programming language it is procedural, (it means it included the c language character c language is procedural oriented language) object-oriented (which means it also follows object-oriented concepts like as c++ language), and functional oriented (it means it is dependent on functions also) language. It is interpreted language (it means its program run on the interpreter.) as we know as before,( three types of language translators are interpreters, assemblers, and compilers ) and the interpreter translation process is done whenever we have to execute the source program) An interpreter checks the program line by line for any errors and then run so it is slower than another language like c++.

It was developed by Guido van Rossum and released in 1991. It is used for server side (it means there are two types of web development client side and server side and it is a part of server-side web development) web development, software development, mathematics, and system scripting. Python works on different platforms like windows, Mac, Linux, raspberry pi, etc python has a simple syntax similar to English languages. Python has a syntax that allows developers to write programs with fewer lines than some other programming languages. Python runs on an interpreter system, which means that code can be executed as soon as it is written this means that proto-typing can be very quick python can be treated in a procedural way, an object-oriented way, or a functional way.

It is opened in two modes

1.      Interactive mode -it allows us to interact with Operating System. Working in interactive mode is convenient for beginners and for testing small pieces of code, as one can test them immediately. But for coding of more than a few lines, we should always save our code so that it can be modified a reused. Python, in interactive mode, is good enough to learn experiment, or explore, but its only drawback is that we cannot save the statements and have to retype all the statements once again to re-run them. Here, when we type python expression/ statement/ command after the prompt(>>>), the python immediately responds with the output of it. Here I used the python 3.11 version. This version is different from the 2.7 python version. Because python version 3.11 is the improved version the syntax in the command prompt will be

>>> print(“welcome to python programming”) to display the text welcome to python programming

on the IDLE shell. and if we want to print the sum of two numbers so just type print(20+20) only the print 40 displays on the screen. it is very easy. As image shows


interactive mode


2. In script mode- we type a Python program in a file and save it with an extension .py and then use an interpreter to execute the content of the file.

For example — I would like to add my first name (string)with my last name(string) so I will create a file from click on the file menu and selecting a new file then typing in it this code-

a= input(“Enter First Name”)

b= input(“Enter Last Name”)

print(“Addition of two string”,a+b)

and save its file name with extension.py for example addi.py as my file name. then run the module by pressing the F5 key. it is also called a module

script mode

The result will be displayed after entering the first name and last name shown below


'image.png' failed to upload.







Comments

Popular posts from this blog

Cascading Style Sheet

Computer introduction

Introduction of C ++ Language