Class 11 Exam  >  Class 11 Notes  >  Textbook - Getting Started with Python, Computer Science (Python), Class 11

Textbook - Getting Started with Python, Computer Science (Python), Class 11 PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


 97 
Chapter 1 
Getting Started 
After studying this lesson, students will be able to:  
? Appreciate the use of Graphical User interface and Integrated Development 
Environment for creating Python programs. 
? Work in interactive & Script mode for programming.  
? Create and assign values to variables. 
? Understand the concept and usage of different data types in python.  
? Appreciate the importance and usage of different types of operator (arithmetic, Relation 
and logical) 
? Create Python expression(s) and statement(s). 
Introduction 
In order to tell the computer „what you want to do?, we write a program in a language 
which computer can understand. Though there are many different programming 
languages such as BASIC, Pascal, C, C++, Java, Haskell, Ruby, Python, etc. but we will 
study Python in this course.  
Before learning the technicalities of Python, let?s get familiar with it.  
Python was created by Guido Van Rossum when he was working at CWI (Centrum 
Wiskunde & Informatica) which is a National Research Institute for Mathematics and 
Computer Science in Netherlands. The language was released in I991. Python got its 
name from a BBC comedy series from seventies- “Monty Python?s Flying Circus”. 
Python can be used to follow both Procedural approach and Object Oriented approach 
of programming. It is free to use.  
Some of the features which make Python so popular are as follows: 
? It is a general purpose programming language which can be used for both 
scientific and non scientific programming. 
? It is a platform independent programming language. 
Page 2


 97 
Chapter 1 
Getting Started 
After studying this lesson, students will be able to:  
? Appreciate the use of Graphical User interface and Integrated Development 
Environment for creating Python programs. 
? Work in interactive & Script mode for programming.  
? Create and assign values to variables. 
? Understand the concept and usage of different data types in python.  
? Appreciate the importance and usage of different types of operator (arithmetic, Relation 
and logical) 
? Create Python expression(s) and statement(s). 
Introduction 
In order to tell the computer „what you want to do?, we write a program in a language 
which computer can understand. Though there are many different programming 
languages such as BASIC, Pascal, C, C++, Java, Haskell, Ruby, Python, etc. but we will 
study Python in this course.  
Before learning the technicalities of Python, let?s get familiar with it.  
Python was created by Guido Van Rossum when he was working at CWI (Centrum 
Wiskunde & Informatica) which is a National Research Institute for Mathematics and 
Computer Science in Netherlands. The language was released in I991. Python got its 
name from a BBC comedy series from seventies- “Monty Python?s Flying Circus”. 
Python can be used to follow both Procedural approach and Object Oriented approach 
of programming. It is free to use.  
Some of the features which make Python so popular are as follows: 
? It is a general purpose programming language which can be used for both 
scientific and non scientific programming. 
? It is a platform independent programming language. 
 98 
? It is a very simple high level language with vast library of add-on modules.   
? It is excellent for beginners as the language is interpreted, hence gives immediate 
results. 
? The programs written in Python are easily readable and understandable.  
? It is suitable as an extension language for customizable applications.  
? It is easy to learn and use. 
The language is used by companies in real revenue generating products, such as:  
? In operations of Google search engine, youtube, etc. 
? Bit Torrent peer to peer file sharing is written using Python 
? Intel, Cisco, HP, IBM, etc use Python for hardware testing.  
? Maya provides a Python scripting API 
? i–Robot uses Python to develop commercial Robot.  
? NASA and others use Python for their scientific programming task.  
First Step with Python 
We are continuously saying that Python is a programming language but don?t know 
what a program is? Therefore, let?s start Python by understanding Program.  
A program is a sequence of instructions that specifies how to perform a Computation. 
The Computation might be mathematical or working with text.  
To write and run Python program, we need to have Python interpreter installed in our 
computer. IDLE (GUI integrated) is the standard, most popular Python development 
environment. IDLE is an acronym of Integrated Development Environment. It lets edit, 
run, browse and debug Python Programs from a single interface. This environment 
makes it easy to write programs.  
We will be using version 2.7 of Python IDLE to develop and run Python code, in this 
course. It can be downloaded from www.python.org 
Python shell can be used in two ways, viz., interactive mode and script mode. Where 
Interactive Mode, as the name suggests, allows us to interact with OS; script mode let us 
Page 3


 97 
Chapter 1 
Getting Started 
After studying this lesson, students will be able to:  
? Appreciate the use of Graphical User interface and Integrated Development 
Environment for creating Python programs. 
? Work in interactive & Script mode for programming.  
? Create and assign values to variables. 
? Understand the concept and usage of different data types in python.  
? Appreciate the importance and usage of different types of operator (arithmetic, Relation 
and logical) 
? Create Python expression(s) and statement(s). 
Introduction 
In order to tell the computer „what you want to do?, we write a program in a language 
which computer can understand. Though there are many different programming 
languages such as BASIC, Pascal, C, C++, Java, Haskell, Ruby, Python, etc. but we will 
study Python in this course.  
Before learning the technicalities of Python, let?s get familiar with it.  
Python was created by Guido Van Rossum when he was working at CWI (Centrum 
Wiskunde & Informatica) which is a National Research Institute for Mathematics and 
Computer Science in Netherlands. The language was released in I991. Python got its 
name from a BBC comedy series from seventies- “Monty Python?s Flying Circus”. 
Python can be used to follow both Procedural approach and Object Oriented approach 
of programming. It is free to use.  
Some of the features which make Python so popular are as follows: 
? It is a general purpose programming language which can be used for both 
scientific and non scientific programming. 
? It is a platform independent programming language. 
 98 
? It is a very simple high level language with vast library of add-on modules.   
? It is excellent for beginners as the language is interpreted, hence gives immediate 
results. 
? The programs written in Python are easily readable and understandable.  
? It is suitable as an extension language for customizable applications.  
? It is easy to learn and use. 
The language is used by companies in real revenue generating products, such as:  
? In operations of Google search engine, youtube, etc. 
? Bit Torrent peer to peer file sharing is written using Python 
? Intel, Cisco, HP, IBM, etc use Python for hardware testing.  
? Maya provides a Python scripting API 
? i–Robot uses Python to develop commercial Robot.  
? NASA and others use Python for their scientific programming task.  
First Step with Python 
We are continuously saying that Python is a programming language but don?t know 
what a program is? Therefore, let?s start Python by understanding Program.  
A program is a sequence of instructions that specifies how to perform a Computation. 
The Computation might be mathematical or working with text.  
To write and run Python program, we need to have Python interpreter installed in our 
computer. IDLE (GUI integrated) is the standard, most popular Python development 
environment. IDLE is an acronym of Integrated Development Environment. It lets edit, 
run, browse and debug Python Programs from a single interface. This environment 
makes it easy to write programs.  
We will be using version 2.7 of Python IDLE to develop and run Python code, in this 
course. It can be downloaded from www.python.org 
Python shell can be used in two ways, viz., interactive mode and script mode. Where 
Interactive Mode, as the name suggests, allows us to interact with OS; script mode let us 
 99 
create and edit python source file. Now, we will first start with interactive mode. Here, 
we type a Python statement and the interpreter displays the result(s) immediately. 
Interactive Mode  
For working in the interactive mode, we will start Python on our computer. You can 
take the help of your Teacher. 
When we start up the IDLE following window will appear:  
 
What we see is a welcome message of Python interpreter with revision details and the 
Python prompt, i.e., „>>>?. This is a primary prompt indicating that the interpreter is 
expecting a python command. There is secondary prompt also which is „…? indicating 
that interpreter is waiting for additional input to complete the current statement. 
Interpreter uses prompt to indicate that it is ready for instruction. Therefore, we can 
say, if there is prompt on screen, it means IDLE is working in interactive mode. 
We type Python expression / statement / command after the prompt and Python 
immediately responds with the output of it. Let?s start with typing print “How are you” 
after the prompt. 
>>>print “How are you?” 
How are you? 
What we get is Python?s response. We may try the following and check the response: 
i) print 5+7 
Page 4


 97 
Chapter 1 
Getting Started 
After studying this lesson, students will be able to:  
? Appreciate the use of Graphical User interface and Integrated Development 
Environment for creating Python programs. 
? Work in interactive & Script mode for programming.  
? Create and assign values to variables. 
? Understand the concept and usage of different data types in python.  
? Appreciate the importance and usage of different types of operator (arithmetic, Relation 
and logical) 
? Create Python expression(s) and statement(s). 
Introduction 
In order to tell the computer „what you want to do?, we write a program in a language 
which computer can understand. Though there are many different programming 
languages such as BASIC, Pascal, C, C++, Java, Haskell, Ruby, Python, etc. but we will 
study Python in this course.  
Before learning the technicalities of Python, let?s get familiar with it.  
Python was created by Guido Van Rossum when he was working at CWI (Centrum 
Wiskunde & Informatica) which is a National Research Institute for Mathematics and 
Computer Science in Netherlands. The language was released in I991. Python got its 
name from a BBC comedy series from seventies- “Monty Python?s Flying Circus”. 
Python can be used to follow both Procedural approach and Object Oriented approach 
of programming. It is free to use.  
Some of the features which make Python so popular are as follows: 
? It is a general purpose programming language which can be used for both 
scientific and non scientific programming. 
? It is a platform independent programming language. 
 98 
? It is a very simple high level language with vast library of add-on modules.   
? It is excellent for beginners as the language is interpreted, hence gives immediate 
results. 
? The programs written in Python are easily readable and understandable.  
? It is suitable as an extension language for customizable applications.  
? It is easy to learn and use. 
The language is used by companies in real revenue generating products, such as:  
? In operations of Google search engine, youtube, etc. 
? Bit Torrent peer to peer file sharing is written using Python 
? Intel, Cisco, HP, IBM, etc use Python for hardware testing.  
? Maya provides a Python scripting API 
? i–Robot uses Python to develop commercial Robot.  
? NASA and others use Python for their scientific programming task.  
First Step with Python 
We are continuously saying that Python is a programming language but don?t know 
what a program is? Therefore, let?s start Python by understanding Program.  
A program is a sequence of instructions that specifies how to perform a Computation. 
The Computation might be mathematical or working with text.  
To write and run Python program, we need to have Python interpreter installed in our 
computer. IDLE (GUI integrated) is the standard, most popular Python development 
environment. IDLE is an acronym of Integrated Development Environment. It lets edit, 
run, browse and debug Python Programs from a single interface. This environment 
makes it easy to write programs.  
We will be using version 2.7 of Python IDLE to develop and run Python code, in this 
course. It can be downloaded from www.python.org 
Python shell can be used in two ways, viz., interactive mode and script mode. Where 
Interactive Mode, as the name suggests, allows us to interact with OS; script mode let us 
 99 
create and edit python source file. Now, we will first start with interactive mode. Here, 
we type a Python statement and the interpreter displays the result(s) immediately. 
Interactive Mode  
For working in the interactive mode, we will start Python on our computer. You can 
take the help of your Teacher. 
When we start up the IDLE following window will appear:  
 
What we see is a welcome message of Python interpreter with revision details and the 
Python prompt, i.e., „>>>?. This is a primary prompt indicating that the interpreter is 
expecting a python command. There is secondary prompt also which is „…? indicating 
that interpreter is waiting for additional input to complete the current statement. 
Interpreter uses prompt to indicate that it is ready for instruction. Therefore, we can 
say, if there is prompt on screen, it means IDLE is working in interactive mode. 
We type Python expression / statement / command after the prompt and Python 
immediately responds with the output of it. Let?s start with typing print “How are you” 
after the prompt. 
>>>print “How are you?” 
How are you? 
What we get is Python?s response. We may try the following and check the response: 
i) print 5+7 
 100 
ii) 5+7 
iii) 6*250/9 
iv) print 5-7 
It is also possible to get a sequence of instructions executed through interpreter. 
Example 1 Example 2 
>>> x=2 
>>> y=6 
>>> z = x+y 
>>> print z 
8 
>>> a=3 
>>> a+1, a-1 
(4,2)   #result is tuple of 2 values    
 
#result is tuple of 2 values, is a comment statement. We will talk about it in the later 
part of chapter. 
Now we are good to write a small code on our own in Python. While writing in Python, 
remember Python is case sensitive. That means x & X are different in Python.  
Note: If we want to repeat prior command in interactive window, you can use „ ? key 
to scroll backward through commands history and „ ? key to scroll forward. Use Enter 
key to select it. Using these keys, your prior commands will be recalled and displayed, 
and we may edit or rerun them also. 
 
^D (Ctrl+D) or quit () is used to leave the interpreter. 
^F6 will restart the shell. 
Help of IDLE can be explored to know about the various menu options available for 
Programmer. 
 
Apart from writing simple commands, let?s explore the interpreter more. 
Page 5


 97 
Chapter 1 
Getting Started 
After studying this lesson, students will be able to:  
? Appreciate the use of Graphical User interface and Integrated Development 
Environment for creating Python programs. 
? Work in interactive & Script mode for programming.  
? Create and assign values to variables. 
? Understand the concept and usage of different data types in python.  
? Appreciate the importance and usage of different types of operator (arithmetic, Relation 
and logical) 
? Create Python expression(s) and statement(s). 
Introduction 
In order to tell the computer „what you want to do?, we write a program in a language 
which computer can understand. Though there are many different programming 
languages such as BASIC, Pascal, C, C++, Java, Haskell, Ruby, Python, etc. but we will 
study Python in this course.  
Before learning the technicalities of Python, let?s get familiar with it.  
Python was created by Guido Van Rossum when he was working at CWI (Centrum 
Wiskunde & Informatica) which is a National Research Institute for Mathematics and 
Computer Science in Netherlands. The language was released in I991. Python got its 
name from a BBC comedy series from seventies- “Monty Python?s Flying Circus”. 
Python can be used to follow both Procedural approach and Object Oriented approach 
of programming. It is free to use.  
Some of the features which make Python so popular are as follows: 
? It is a general purpose programming language which can be used for both 
scientific and non scientific programming. 
? It is a platform independent programming language. 
 98 
? It is a very simple high level language with vast library of add-on modules.   
? It is excellent for beginners as the language is interpreted, hence gives immediate 
results. 
? The programs written in Python are easily readable and understandable.  
? It is suitable as an extension language for customizable applications.  
? It is easy to learn and use. 
The language is used by companies in real revenue generating products, such as:  
? In operations of Google search engine, youtube, etc. 
? Bit Torrent peer to peer file sharing is written using Python 
? Intel, Cisco, HP, IBM, etc use Python for hardware testing.  
? Maya provides a Python scripting API 
? i–Robot uses Python to develop commercial Robot.  
? NASA and others use Python for their scientific programming task.  
First Step with Python 
We are continuously saying that Python is a programming language but don?t know 
what a program is? Therefore, let?s start Python by understanding Program.  
A program is a sequence of instructions that specifies how to perform a Computation. 
The Computation might be mathematical or working with text.  
To write and run Python program, we need to have Python interpreter installed in our 
computer. IDLE (GUI integrated) is the standard, most popular Python development 
environment. IDLE is an acronym of Integrated Development Environment. It lets edit, 
run, browse and debug Python Programs from a single interface. This environment 
makes it easy to write programs.  
We will be using version 2.7 of Python IDLE to develop and run Python code, in this 
course. It can be downloaded from www.python.org 
Python shell can be used in two ways, viz., interactive mode and script mode. Where 
Interactive Mode, as the name suggests, allows us to interact with OS; script mode let us 
 99 
create and edit python source file. Now, we will first start with interactive mode. Here, 
we type a Python statement and the interpreter displays the result(s) immediately. 
Interactive Mode  
For working in the interactive mode, we will start Python on our computer. You can 
take the help of your Teacher. 
When we start up the IDLE following window will appear:  
 
What we see is a welcome message of Python interpreter with revision details and the 
Python prompt, i.e., „>>>?. This is a primary prompt indicating that the interpreter is 
expecting a python command. There is secondary prompt also which is „…? indicating 
that interpreter is waiting for additional input to complete the current statement. 
Interpreter uses prompt to indicate that it is ready for instruction. Therefore, we can 
say, if there is prompt on screen, it means IDLE is working in interactive mode. 
We type Python expression / statement / command after the prompt and Python 
immediately responds with the output of it. Let?s start with typing print “How are you” 
after the prompt. 
>>>print “How are you?” 
How are you? 
What we get is Python?s response. We may try the following and check the response: 
i) print 5+7 
 100 
ii) 5+7 
iii) 6*250/9 
iv) print 5-7 
It is also possible to get a sequence of instructions executed through interpreter. 
Example 1 Example 2 
>>> x=2 
>>> y=6 
>>> z = x+y 
>>> print z 
8 
>>> a=3 
>>> a+1, a-1 
(4,2)   #result is tuple of 2 values    
 
#result is tuple of 2 values, is a comment statement. We will talk about it in the later 
part of chapter. 
Now we are good to write a small code on our own in Python. While writing in Python, 
remember Python is case sensitive. That means x & X are different in Python.  
Note: If we want to repeat prior command in interactive window, you can use „ ? key 
to scroll backward through commands history and „ ? key to scroll forward. Use Enter 
key to select it. Using these keys, your prior commands will be recalled and displayed, 
and we may edit or rerun them also. 
 
^D (Ctrl+D) or quit () is used to leave the interpreter. 
^F6 will restart the shell. 
Help of IDLE can be explored to know about the various menu options available for 
Programmer. 
 
Apart from writing simple commands, let?s explore the interpreter more. 
 101 
Type Credits after the prompt and what we get is information about the organization 
involved in Python development. Similarly, Copyright and Licenses command can be 
used to know more about Python. Help command provides help on Python. It can be 
used as….. help() with nothing in parenthesis will allow us to enter an interactive help 
mode. And with a name (predefined) in bracket will give us details of the referred 
word.  
To leave the help mode and return back to interactive mode, quit command can be 
used. 
Script Mode 
In script mode, we type Python program in a file and then use the interpreter to execute 
the content from the file. Working in interactive mode is convenient for beginners and 
for testing small pieces of code, as we can test them immediately. But for coding more 
than few lines, we should always save our code so that we may modify and reuse the 
code.  
Note: Result produced by Interpreter in both the modes, viz., Interactive and script 
mode is exactly same.  
Python, in interactive mode, is good enough to learn, experiment or explore, but its only 
drawback is that we cannot save the statements for further use and we have to retype 
all the statements to re-run them. 
To create and run a Python script, we will use following steps in IDLE, if the script 
mode is not made available by default with IDLE environment.  
1. File>Open OR File>New Window (for creating a new script file)  
2. Write the Python code as function i.e. script 
3. Save it (^S) 
4. Execute it in interactive mode- by using RUN option (^F5) 
 Otherwise (if script mode is available) start from Step 2 
Note: For every updation of script file, we need to repeat step 3 & step 4 
 
Read More

Top Courses for Class 11

FAQs on Textbook - Getting Started with Python, Computer Science (Python), Class 11

1. What is Python?
Ans. Python is a high-level programming language that is widely used for developing various applications. It is known for its simplicity, readability, and versatility. Python supports multiple programming paradigms and has a vast standard library that makes it easier to accomplish complex tasks.
2. How can I get started with Python programming?
Ans. To get started with Python programming, you can follow these steps: 1. Install Python: Download and install the latest version of Python from the official website. 2. Set up the development environment: Choose an Integrated Development Environment (IDE) or a text editor to write your Python code. 3. Learn the basics: Familiarize yourself with Python syntax, data types, control structures, and functions. 4. Practice coding: Start writing simple programs to apply what you have learned and gain hands-on experience. 5. Explore libraries and frameworks: Python has a vast ecosystem of libraries and frameworks that can help you solve specific problems or build applications faster.
3. What are the key features of Python?
Ans. The key features of Python programming language include: 1. Easy to learn and read: Python has a simple and readable syntax, making it easier for beginners to understand and write code. 2. Cross-platform compatibility: Python programs can run on various operating systems, including Windows, macOS, and Linux. 3. Extensive standard library: Python comes with a wide range of modules and libraries that provide ready-to-use functions and tools for different tasks. 4. Object-oriented programming support: Python supports object-oriented programming principles, allowing developers to create reusable and modular code. 5. Large community and ecosystem: Python has a thriving community of developers who contribute to open-source projects, provide support, and share resources.
4. How can Python be used in computer science?
Ans. Python is extensively used in computer science for various purposes, including: 1. Web development: Python frameworks like Django and Flask are used to build web applications. 2. Data analysis and visualization: Python libraries like NumPy, Pandas, and Matplotlib are used for data manipulation, analysis, and visualization. 3. Artificial Intelligence and Machine Learning: Python provides libraries such as TensorFlow, Keras, and Scikit-learn, which are popular for developing AI and ML models. 4. Network programming: Python's socket module allows developers to create network applications and implement protocols. 5. Scripting and automation: Python's scripting capabilities make it useful for automating repetitive tasks and writing system administration scripts.
5. What is the importance of Python in the field of education?
Ans. Python holds significant importance in the field of education due to the following reasons: 1. Easy to learn: Python's simple syntax and readability make it an ideal programming language for beginners, allowing them to grasp fundamental programming concepts easily. 2. Versatility: Python can be used in various domains such as web development, data analysis, scientific computing, artificial intelligence, etc., making it a valuable skill for students pursuing diverse fields. 3. Large community and resources: Python has a vast community of developers who actively contribute to open-source projects and provide extensive documentation, tutorials, and learning resources, making it easier for students to learn and seek help. 4. Job prospects: Python is widely used in the industry, and proficiency in Python programming opens up numerous career opportunities for students in sectors like software development, data science, and machine learning. 5. Academic support: Many educational institutions and universities incorporate Python into their curriculum, providing students with the necessary resources and support to learn and apply Python in their academic projects and research.
Download as PDF
Explore Courses for Class 11 exam

Top Courses for Class 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

Textbook - Getting Started with Python

,

Sample Paper

,

Viva Questions

,

Class 11

,

Previous Year Questions with Solutions

,

Textbook - Getting Started with Python

,

Extra Questions

,

pdf

,

Objective type Questions

,

video lectures

,

Computer Science (Python)

,

Free

,

Exam

,

Important questions

,

shortcuts and tricks

,

mock tests for examination

,

study material

,

Summary

,

Computer Science (Python)

,

MCQs

,

practice quizzes

,

Class 11

,

Textbook - Getting Started with Python

,

Semester Notes

,

Class 11

,

past year papers

,

Computer Science (Python)

,

ppt

;