Grade 11 Exam  >  Grade 11 Notes  >  Computer Science for Grade 11  >  Familiarization with the basics of Python programming

Familiarization with the basics of Python programming | Computer Science for Grade 11 PDF Download

Introduction

Python is an open-source, object-oriented, high-level programming language developed by Guido Van Rossum in 1990, and released in 1991, at the National Research Institute for Mathematics, Netherlands.

  • Presently owned by Python Software Foundation (PSF).
  • Python is influenced by two programming languages:
  • ABC language, a teaching language created to replace the programming language BASIC.
  • Modula-3 is a language that preserves the power of a systems programming language
  • Python is a general-purpose programming language that can be used to build any kind of program that does not require direct access to the computer’s hardware.

Characteristics of Python

  • It supports functional and structured programming methods as well as OOP.
  • It can be used as a scripting language or can be compiled to byte-code for building large applications.
  • It provides very high-level dynamic data types and supports dynamic type checking.
  • It supports automatic garbage collection.
  • It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
  • It can be used to develop a large application with small codes.

Python – Advantages

It has become popular because of its salient features –

  • Easy – loosely typed OOP language with few keywords and simple English like structure, and is easy to learn
  • Takes less time to develop the program, typically 3-5 times shorter than equivalent Java programs. Due to Built-in high-level data types, and dynamic typing.
  • Free and Open Source, High-Level, Portable, and Object-Oriented
  • Extensible & Embeddable
  • Interpreted – Python is interpreted, interactive, and directly executed with pre-compiled code. This means that it is processed at runtime by the interpreter and you need not compile your program before executing it.
  • Large Standard Library and support GUI Programming (using MFC, Tkinter)
  • Python is used for both scientific and non-scientific programming.
  • Python is a case-sensitive programming language.

Python – Disadvantages

It has some minus i.e. disadvantages –

  • Not the fastest Languages – Python is an interpreted language, not a compiled language. It converts python source code into the internal bytecode, which is then executed by the Python interpreter. It makes slower than fully compiled languages.
  • Not strong as Type Binding – Python does not strongly bind with data types i.e. type.
  • Not easy to convert code into other languages – It is not easy to translate a Python program into other programming languages because Python does not have strong syntax.

Installation of Python

Working with Python:

  • Python Interpreter: Python interpreter must be installed on your computer, to write and execute a Python program. It is also called a Python shell.
  • >>> : Symbol >>> is called Python prompt.
  • Python prompt: Python prompt, which indicates that the interpreter is ready to receive instructions. We can type commands or statements on this prompt for execution.

Python Interpreter ShellPython Interpreter Shell

Execution Mode
There are two ways to run a program using the Python interpreter:
a) Interactive mode and b) Script mode
(A) Interactive Mode

  • In the interactive mode, we can type a Python statement on the >>> prompt directly. As soon as we press enter, the interpreter executes the statement and displays the result(s)

Executing code in Interactive modeExecuting code in Interactive mode

Advantages of using interactive mode :

  • It is convenient for testing a single line code for instant execution.

The disadvantage of using Interactive mode :

  • In the interactive mode, we cannot save the statements for future use and we have to retype the statements to run them again.

(B) Script Mode

In the script mode, we can write a Python program in a file, save it and then use the interpreter to execute the program from the file.

  • Python program files have a .py extension.
  • Python programs are also known as scripts.
  • Python has a built-in editor called IDLE which can be used to create programs / scripts.

Python IDLE :

  • IDLE: Integrated Development and Learning Environment

To Create a Program

  • First open the IDLE,
  • Click File>New File to create a new file,
  • then write your program on that file and
  • save it with the desired name.
  • By default, the Python scripts are saved in the Python installation folder.

To run/execute a program in script mode:

  • Open the program using an IDLE editor
  • In IDLE, go to [Run]->[Run Module] to execute the program
  • The output appears on the shell.

Executing program in Script ModeExecuting program in Script Mode

The document Familiarization with the basics of Python programming | Computer Science for Grade 11 is a part of the Grade 11 Course Computer Science for Grade 11.
All you need of Grade 11 at this link: Grade 11
84 videos|19 docs|5 tests

Top Courses for Grade 11

84 videos|19 docs|5 tests
Download as PDF
Explore Courses for Grade 11 exam

Top Courses for Grade 11

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Previous Year Questions with Solutions

,

Familiarization with the basics of Python programming | Computer Science for Grade 11

,

practice quizzes

,

Extra Questions

,

mock tests for examination

,

shortcuts and tricks

,

MCQs

,

pdf

,

past year papers

,

study material

,

Important questions

,

Exam

,

Summary

,

Sample Paper

,

Familiarization with the basics of Python programming | Computer Science for Grade 11

,

Semester Notes

,

Objective type Questions

,

Familiarization with the basics of Python programming | Computer Science for Grade 11

,

video lectures

,

Free

,

Viva Questions

,

ppt

;