0% found this document useful (0 votes)
47 views10 pages

11computer Science-Computational Thinking & Getting Started With Python - Notes and Video Link

(1) Computational thinking refers to problem-solving processes used in computer science. It involves breaking problems down, recognizing patterns, abstracting details, developing algorithms, and generalizing solutions. (2) Python is an interpreted, object-oriented, high-level programming language. It has features like easy readability, cross-platform capabilities, a large standard library, and is useful for web and application development. (3) In Python, programs can be run interactively or as scripts. Interactive mode allows testing code immediately but does not save programs, while script mode saves files to disk for reuse and modification. Both modes allow decomposing problems and practicing computational thinking.

Uploaded by

xomavi8122
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
47 views10 pages

11computer Science-Computational Thinking & Getting Started With Python - Notes and Video Link

(1) Computational thinking refers to problem-solving processes used in computer science. It involves breaking problems down, recognizing patterns, abstracting details, developing algorithms, and generalizing solutions. (2) Python is an interpreted, object-oriented, high-level programming language. It has features like easy readability, cross-platform capabilities, a large standard library, and is useful for web and application development. (3) In Python, programs can be run interactively or as scripts. Interactive mode allows testing code immediately but does not save programs, while script mode saves files to disk for reuse and modification. Both modes allow decomposing problems and practicing computational thinking.

Uploaded by

xomavi8122
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

Class-XI

Computer Science

Computational thinking and getting started with python-Notes

What is Computational Thinking?


It refers to the collective thought processes involved in formulating
problems and solutions so that they are represented in a form that can be effectively
carried out by a computer. It is an approach to solving problems using concepts and ideas
from computer science

Characteristics of computational thinking:


It is a problem solving process that includes the following characteristics:
(A)Decomposition: Breaking down a complex problem data or process into smaller parts
to make it in simple form.
(B)Pattern recognition: It refers to the looking for patterns and trends in data.
(C)Abstraction: Showing the important information and hiding background details.
 Generalization : It is identifying the common or shared characteristics .
(D)Algorithm: Developing step by step instructions to solve the problem.
Now we will discuss all these characteristics in detail:
DECOMPOSITION :
It is the process of breaking down a big or complex problem into a set of smaller sub-
processes to allow us to understand and execute the problem better.
Decomposition is done by :
1) Dividing a task into a sequence of subtasks
2) Identify elements or parts of a complex system. Ex: while writing a program divide it
into functions.
PATTERN RECOGNITION
It refers to observing or looking for similarities or pattern among and within small,
decomposed problems. The identified pattern helps to solve more complex problems
more efficiently.
Pattern recognition is done by :
1) Identify similarities or common differences that lead us to shortcuts
2) Using identified shortcut, mapping problems to possible solution. EX :
Scientist and engineers look for pattern in data
ABSTRACTION
It refers to focusing on information relevant to a context or problem and hiding the
background details. It is done by:
1) Recognizing the context.
2) Identifying the information relevant to the context.
Ex: A calculator that shows only numbers and operators

GENERALIZATION
It refers to identifying common or shared characteristics between two domains or
problem such that models or solutions of one could be adapted or applied to the other.

ALGORITHM
An algorithm is a sequence of steps that solves a problem by working on some input data
and producing a desired outcome. Algorithm design involves both creation and execution
of an algorithm. Algorithm Design is done by
1) What steps are needed to solve ?
2) How can the steps best be organized?
MEMORY MAP

GETTING STARTED WITH PYTHON


Introduction to Python :

Python is object oriented high level computer language developed by Guido Van
Rossum in 1991 . It was named after a British TV show namely ‘Monty Python’s Flying
circus’. As we all know that the computers understand the language of 0s and 1s which
is called machine language or low level language. However it is difficult for human to
write or comprehend instructions using 0s and 1s. This led to invent of high level
languages like python, C, C++, PHP, Java, Visual Basic that are easier to manage by
human but are not directly understood by the computer.
A program written in a high level language is called source
code. The software that converts the source code to object code is known as language
translators. There are three types of language translators: Compiler, Interpreter and
Assembler. Python uses interpreter to convert its instruction into machine code. An
interpreter processes the program statements one by one, first translating and then
executing. This process is continued until an error is encountered or the whole program
is executed successfully. On the contrary, a compiler translates the entire source code as
a whole, into the object code. After scanning the whole program, it generates error
messages, if any.

Features of Python:

1. Python is a high level language. It is a free and open source language.


2. It is an interpreted language, as python programs are executed by an interpreter.
3. Python programs are easy to understand as they have a clearly defined syntax and
relatively simple structure.
4. Python is case sensitive. For example NUMBER and number are not same.
5. Python is portable and platform independent means it can run on various operating
systems and hardware platforms.
6. Python has a rich library of predefined functions.
7. Python is also useful in web development. Many popular web services and
applications are built using python.
8. Python uses indentation for blocks and nested blocks.

Some advantages of python are:


 Easy to use
 Expressive language
 Cross platform
 Free and open sources

Some limitations of python are :


 Not the fastest language
 Lesser libraries
 Not strong on Data type mismatch
 Not easily Convertible
Working with python:

To write and run a python program, we need to have a python interpreter installed on our
computer or we can use any online python interpreter. The interpreter is also called
python shell. A sample screen of python interpreter is shown below:

In the above screen, the symbol >>> is the python prompt, which indicates that the
interpreter is ready to take instructions. We can type commands or statements on this
prompt to execute them using a python interpreter.

Downloading Python : The latest version of python 3 is available on the official


website : http://www.python.org/

Execution modes :
You can work in python in following ways:
1) In interactive mode
2) In script mode
Interactive modes do not save commands in form of a program and also output is
sandwiched between commands. It is suitable for testing codes. It allows us to interact
with operating system. Hear, when we type python statement, interpreter displays the
result immediately. That means, when we type expression/statement/command after the
prompt (>>>) , the python immediately responses with the output of it. Let see what will
happen when we type “welcome to python programming” after the prompt.
>>>print(“welcome to python programming”)
welcome to python programming
EXAMPLE:
>>> print 4+5
9
>>>x=10
>>>y=20
>>>print x*y
200
A sample code written in interactive mode is shown below:

Script mode is useful for creating programs and then run the program later and gets
computer output. In script mode, we type python program in a file and then use
interpreter to execute the content of the file. By default, the python scripts are saved in
the python installation folder with extension .py . To execute a script, we can either
1. Type the file name along with the path at the prompt . For example if the name of the
file is sample.py , we type sample.py . We can otherwise open the program directly
from IDE.
2. While working in the script mode, after saving the file, click [Run]->[Run Module]
from the menu.
Comparison between interactive mode and script mode :
Working in interactive mode is convenient for beginners and for testing small piece of
code, as one can test them immediately. But for coding of more than few lines, we should
always save our code so that it can be modified and reused. Python interactive interpreter
is also called Python shell.
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 be run again. A sample code of program written in script code is shown below:
You can also refer the video given below for interactive and script mode of python:
https://youtu.be/alvukR88UTw
A basic program in python
(1) In interactive mode
>>> print(“hello”)
(2) In script mode
FileNew
Print(“hello”)
Click Filesave with extension .py
Chooserun module
Output will be displayed as hello in a separate shell window
print() is a function in python.
Simple programs in python
PROGRAM :1 Write a program to input user name and print it.
First read the instructions:
You can write the program in interactive mode or in script mode.
Now see the code :
In interactive mode :
>>>name = input( “ What is your name ?”) #press enter key
What is your name ? | (cursor will blink here)
The value that you type in front of the displayed prompt will be
assigned to given variable, name in above case.
>>>print(name)
------------------- (entered value will be printed here)
Python will enclose the value of name in quotes while displaying it
because whatever value we enter through input( ) function it is treated
as a string.
The same program can be done in script mode also as per the
instructions given in the chapter.
PROGRAM:2 Write a program to input your age and print it.
In interactive mode :
>>> age = int (input (“ Enter your age”))
Enter your age |
>>>print(age)
The value that you type in front of the displayed prompt will be
assigned to the given variable age .
Here we have used int ( ) function to convert string to integer.
Now the value of age will not be displayed in quotes. It will be
displayed as integer.
NOTE
The input( ) function always returns a value in string type.
The int( ) function is used to convert string type to integer.

You might also like