KEMBAR78
Techtipnow in Python Revision Tour Class 12 Notes ... | PDF | String (Computer Science) | Python (Programming Language)
0% found this document useful (0 votes)
38 views9 pages

Techtipnow in Python Revision Tour Class 12 Notes ...

The document provides comprehensive notes on Python programming for Class 12, covering fundamental concepts such as variables, data types, operators, and control flow. It includes detailed explanations of Python's features, execution modes, and data structures like lists, tuples, and dictionaries, along with examples for clarity. The content is designed to help students build a strong foundation in Python programming and includes practical coding examples and operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views9 pages

Techtipnow in Python Revision Tour Class 12 Notes ...

The document provides comprehensive notes on Python programming for Class 12, covering fundamental concepts such as variables, data types, operators, and control flow. It includes detailed explanations of Python's features, execution modes, and data structures like lists, tuples, and dictionaries, along with examples for clarity. The content is designed to help students build a strong foundation in Python programming and includes practical coding examples and operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

techtipnow Online Test downloads

KVS-PGT  CUET  BPSC  Project/Practicals  Textbook Solution  IT-402/802  Computer Science (083) 

Informatics Practices (065) 

Monetize your app


today

Yango Ads Ad Network Open

Python Revision Tour Class 12 Notes | CBSE Computer Science Search... 


2 Comments / Uncategorized / By Sanjay Kumar

Python Revision Tour Class 12 Notes covers Python Fundamentals of class 11 including Variables, Operators, Input
Categories
and Output, Flow of control, Expressions, Type Casting, Strings, List, Tuples, Dictionary. All the concepts are
Artificial Intelligence
explained with examples so that students can build strong foundation in Python Programming Fundamentals.
Boolean Algebra

Class 9 IT 402 Notes


Contents [hide]
Cloud Computing
1 Getting Started with Python
Computer Fundamental MCQ
2 Strings
3 List Computer Fundamentals
4 Tuple Computer Network
5 Dictionary
Computer Network MCQ

Getting Started with Python Computer Science Practicals

CS Class 11
Python is a General Purpose high level Programming language used for developing application softwares.
CS Class 11 MCQ

Features of Python CS Class 12 MCQ

CS Class 12 Tutorial
High Level
CSV File MCQ
Free and Open Source
CSV Files
Case Sensitive
Interpreted CUET Computer Science Preparation

Plateform Independent Cyber Crime


Rich library of functions
Cyber Safety
Dynamic
Cyber Security MCQ
General Purpose
Database Concept

Working with Python DBMS MCQs

Emerging Trends
To write and run python programs we need Python Interpreter also called Python IDLE.
Find the Output

Execution Mode Internet

Internet MCQ
We can use Python Interpreter in two ways:
IOT

Interactive mode IP Class 11 MCQ

Script mode IP Class 11 Tutorial

IP Class 12 MCQ
Interactive Mode
IP Class 12 Tutorial

Instant execution of individual statement IP Practicals


Convenient for testing single line of code
IT 402 Class 10
We cannot save statements for future use
IT 802 Class 11 MCQ

Script Mode IT 802 Class 11 Tutorial

IT 802 Class 12 MCQ


Allows us to write and execute more than one Instruction together.
IT 802 Class 12 Tutorial
We can save programs (python script) for future use
Java Programming
Python scripts are saved as file with extension “.py”
KVS PGT Computer Science
How to execute or run python program
Matplotlib Pyplot

NCERT Solutions
Open python IDLE
Click ‘File’ and select ‘New’ to open Script mode Open Office Tutorial

Type source code and save it Operating System


Click on ‘Run’ menu and select ‘Run Module’
Python Data Structure

Python DataFrame

python exception handling mcq

Python MCQ

Python Pandas

Python Pandas MCQ

Python Programs

Python Pyplot MCQ


Python Keywords
Python Series

These are predefined words which a specific meaning to Python Interpreter. Python Tutorials

These are reserve keywords RDBMS


Keywords in python are case sensitive Societal Impact

Societal Impact MCQ

Spreadsheet

SQL MCQ

SQL Practicals

Identifier SQL Tutorials

Sumita Arora Solution


Identifiers are name used to identify a variable, function or any other entities in a programs.
Uncategorized

Rules for naming Identifier

The name should begin with an alphabet or and underscore sign and can be followed by any combination of
charaters a-z, A-Z, 0-9 or underscore.
It can be of any length but we should keep it simple, short and meaningful.
it should not be a python keyword or reserved word.
We cannot use special symbols like !, @, #, $, % etc. in identifiers.

Variables

It can be referred as an object or element that occupies memory space which can contain a value.
Value of variable can be numeric, alphanumeric or combination of both.
In python assignment statement is used to create variable and assign values to it.

Data types

These are keywords which determine the type of data stored in a variable. Following table show data types used in python:
Comments

These are statement ignored by python interpreter during execution.


It is used add a remark or note in the source code.
It starts with # (hash sign) in python.

Operators

These are special symbols used to perform specific operation on values. Different types of operator supported in python are
given below:

Arithmetic operator
Relational operator
Assignment operator
Logical operator
Identity operator
Membership operator

Expressions

An expression is combination of different variables, operators and constant which is always evaluated to a value.
A value or a standalone variable is also considered as an expression.

Example

56 + (23-13) + 89%8 – 2*3

Evaluation:

= 56 + (23 -13) + 89%8 – 2*3 #step1


= 56 + 10 + (89%8) – 2*3 #step2
= 56 + 10 + 1 – (2*3) #step3
= (56 + 10) + 1 – 6 #step4
= (66 + 1) – 6 #step5
= 67 – 6 #step6
= 61

Statement

A statement is unit of code that the python interpreter can execute.

Example:

var1 = var2 #assignment statement


x = input (“enter a number”) #input statement
print (“total = “, R) #output statement

How to input values in python?

In python we have input() function for taking user input.

Syntax:

Input([prompt])

How to display output in python?

In python we have print() function to display output.

Syntax:

print([message/value])

Example:

Python program to input and output your name

var = input(“Enter your name”)


print(“Name you have entered is “, var)

Example:

Addition of two numbers

Var1 = int(input(“enter no1”))


Var2 = int(input(“enter no2”))
Total = Var1 + Var2
Print(“Total = “, Total)

Type Conversion

Type conversion refers to converting one type of data to another type.

Type conversion can happen in two ways:

Explicit conversion
Implicit conversion

Explicit Conversion

Explicit conversion also refers to type casting.


In explicit conversion, data type conversion is forced by programmer in program

Syntax:

(new_data_type) = (expression)
Explicit type conversion function

Example:

Program of explicit type conversion from float to int

x = 12
y=5
print(x/y) #output – 2.4
print(int(x/y)) #output – 2

Program of explicit type conversion from string to int

x = input(“enter a number”)
print(x+2) #output – produce error “can only concatenate str to str
x = int(input(Enter a number”))
print(x+2) #output – will display addition of value of x and 2

Implicit conversion

Implicit conversion is also known as coercion.


In implicit conversion data type conversion is done automatically.
Implicit conversion allows conversion from smaller data type to wider size data type without any loss of information

Example:

Program to show implicit conversion from int to float

var1 = 10 #var1 is integer


var2 = 3.4 #var2 is float
res = var1 – var2 #res becomes float automatically after subtraction
print(res) #output – 6.6
print(type(res)) #output – class ‘Float’

Strings
String is basically a sequence which is made up of one or more UNICODE characters.
Character in string can be any letter, digit, whitespace or any other symbol.
String can be created by enclosing one or more characters in single, double or triple quotes.

Examples:

Accessing characters in a string (INDEX)

Individual character in a string can be accessed using indexes.


Indexes are unique numbers assigned to each character in a string to identify them
Index always begins from 0 and written in square brackets “[]”.
Index must be an zero, positive or negative integer.
We get IndexError when we give index value out of the range.

Negative Index

Python allows negative indexing also.


Negative indices are used when you want to access string in reverse order.
Starting from the right side, the first character has the index as -1 and the last character (leftmost) has the index –n
where n is length of string.

Is string immutable?

Yes, string is immutable data type. The content of string once assigned cannot be altered than.
Trying to alter string content may lead an error.

String operations

String supports following operations:

Concatenation
Repetition
Membership
Slicing

Concatenation

Concatenation refers to joining two strings.


Plus (‘+’) is used as concatenation operator.

Repetition

Repetition as it name implies repeat the given string.


Asterisk (‘*’) is used as repetition operator.

Membership

Membership operation refers to checking a string or character is part or subpart of an existing string or not.
Python uses ‘in’ and ‘not in’ as membership operator.
‘in’ returns true if the first string or character appears as substring in the second string.
‘not in’ returns true if the first string or character does not appears as substring in the second string.

Slicing

Extracting a specific part of string or substring is called slicing


Subset occurred after slicing contains contiguous elements
Slicing is done using index range like string[start_index : end_index : step_value]
End index is always excluded in resultant substring.
Negative index can also be used for slicing.

Traversing a String

Traversing a string refers to accessing each character of a given string sequentially.


For or while loop is used for traversing a string

String Functions

List
List is built in sequence data type in python.
Stores multiple values
List item can be of different data types
All the items are comma separated and enclosed in square bracket.
Individual item in a list can be accessed using index which begins from 0.

Examples

Accessing elements in a List

Individual item in a list can be accessed using indexes.


Indexes are unique numbers assigned to each item in a list to identify them
Index always begins from 0 and written in square brackets “[]”.

Example:

List is Mutable

Yes list is mutable.


Content of the list can be changed after it has been created.
List operations

List supports following operations:

Concatenation
Repetition
Membership
Slicing

Concatenation

Concatenation refers to joining two List.


Plus (‘+’) is used as concatenation operator.
Concatenating List with other data type produces TypeErrors.

Example:

Repetition

Repetition as it name implies used to replicate a list at specified no of times.


Asterisk (‘*’) is used as repetition operator.

Membership

Membership operation refers to checking an item is exists in the list or not.


Python uses ‘in’ and ‘not in’ as membership operator.
‘in’ returns true if the item specified present in the list.
‘not in’ returns true if the item specified present in the list.

Example:

Slicing

Extracting a subset of items from given list is called slicing


Subset occurred after slicing contains contiguous items.
Slicing is done using index range like List[start_index : end_index : step_value]
End index is always excluded in resultant subset of list.
Negative index can also be used for slicing.

Examples:

Traversing a List

Traversing a List refers to accessing each item a given list sequentially.


for or while loop can be used for traversing a list.

Examples:

List methods | List Functions


Nested List

One list appears as an element inside another list.

Example:

Tuple
Tuple is built in sequence data type in python.
Stores multiple values
Tuple item can be of different data types
All the items are comma separated and enclosed in parenthesis ‘()’.
Individual item in a Tuple can be accessed using index which begins from 0.
In case of single item present in tuple, it should also be followed by a comma.
A sequence without parenthesis is treated as tuple by default.

Examples

Accessing elements in a Tuple

Individual item in a Tuple can be accessed using indexes.


Indexes are unique numbers assigned to each item in a Tuple to identify them
Index always begins from 0 and written in square brackets “[]”.

Example:

Tuple is Immutable

Yes Tuple is Immutable.


Content of the Tuple cannot be changed after it has been created.

Example:
Tuple operations

Tuple supports following operations:

Concatenation
Repetition
Membership
Slicing

Concatenation

Concatenation refers to joining two Tuple.


Plus (‘+’) is used as concatenation operator.
Concatenation operator can also be used for extending an existing tuple.

Example:

Repetition

Repetition as it name implies used to repeat elements of a Tuple at specified no of times.


Asterisk (‘*’) is used as repetition operator.

Membership

Membership operation refers to checking an item exists in Tuple or not.


Python uses ‘in’ and ‘not in’ as membership operator.
‘in’ returns true if the item specified present in the Tuple.
‘not in’ returns true if the item specified present in the Tuple.

Example:

Slicing

Extracting a subset of items from given Tuple is called slicing


Subset occurred after slicing contains contiguous items.
Slicing is done using index range like Tuple[start_index : end_index : step_value]
End index is always excluded in resultant subset of Tuple.
Negative index can also be used for slicing.

Examples:

Traversing a Tuple

Traversing a Tuple refers to accessing each item a given Tuple sequentially.


for or while loop can be used for traversing a Tuple.

Examples:

Tuple Methods and Built in Functions


Nested Tuple

One Tuple appears as an element inside another Tuple.

Example:

Tuple Assignment

Tuple Assignment allows elements of tuple on the left side of assignment operator to be assigned respective values from a
tuple on the right side.

Dictionary
Dictionaries are unordered collection of items falls under mapping.
Stores data in form of key:value pair called item.
Key is separated from its value by colon ‘:’ and items are separated by comma.
All items of dictionaries are enclosed in curly bracket ‘{}’.
The keys in the dictionary must be unique and should be of immutable data type.
The value can be repeated and of any data type.

Creating a Dictionary

Accessing items in a Dictionary

Items of dictionary are accessed using keys.


Each key of dictionary serve as index and maps to a value.
If key is not present in dictionary, then we get KeyError.

Examples

Dictionary is Mutable

Yes, Dictionary is Mutable as its content can be changed after it has been created.

Adding a new item in Dictionary

Modifying an existing Item in Dictionary

Traversing a dictionary

Dictionary methods and built in functions


← Previous Post Next Post →

Related Posts

18.What is missing data? 19. Why is missing data 2. What will be the output of the following code?
filled in Dataframe with some value? 20. Name the 2. SELECT CONCAT (CONCAT(‘Inform’, ‘atics’),
function you can use for filling missing data? 21. ‘Practices’);
Name some function to handle missing data. 3. SELECT LCASE (’INFORMATICS PRACTICES
Leave a Comment / Uncategorized / By Sanjay Kumar CLASS 11TH‘);
4. SELECT UCASE (’Computer Studies‘);
5. SELECT CONCAT (LOWER (‘Class’), UPPER (‘xii’));
Leave a Comment / Uncategorized / By Sanjay Kumar

2 thoughts on “Python Revision Tour Class 12 Notes | CBSE Computer


Science”

SWAGATA BANERJEE
MARCH 21, 2023 AT 1:02 AM

Sir, how can I get the pdf form of your notes

Reply

AARUSHI SINGH
APRIL 19, 2024 AT 12:08 AM

Fun stuff, thanks! :))

19 April 2024,
Friday,
5:37 A.M. :))

Reply

Leave a Comment
Your email address will not be published. Required fields are marked *

Type here..

Name* Email* Website

Save my name, email, and website in this browser for the next time I comment.

Post Comment »

About Terms and Conditions Private Policy Refund Policy Contact Us Sitemap | Copyright © 2025 techtipnow

You might also like