0% found this document useful (0 votes)
5 views20 pages

12th CS Python Revision Tour

The document provides an overview of Python programming, covering its introduction, keywords, identifiers, datatypes, operators, and control structures. It explains various programming concepts such as input-output, type conversion, debugging, and string and list operations. Additionally, it highlights the mutable and immutable nature of data types like lists and dictionaries, along with built-in functions and their usage.
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)
5 views20 pages

12th CS Python Revision Tour

The document provides an overview of Python programming, covering its introduction, keywords, identifiers, datatypes, operators, and control structures. It explains various programming concepts such as input-output, type conversion, debugging, and string and list operations. Additionally, it highlights the mutable and immutable nature of data types like lists and dictionaries, along with built-in functions and their usage.
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

Contents

1) Introduction
2) Keywords
3) Identifiers
4) Datatypes
5) Operators
6) Comments
7) Expression
8) Input – Output
9) Type conversion
10) Debugging

CONTENTS
Introduction - Basics -
What is Python ?
Python is a programming language
- Developed by Guido van Rossum in 1997
- Used to develop Games, Websites, Apps, etc.
- Simple and Portable
- Free and Open source
- Case Sensitive KEYWORDS – Reserved Words in Python
- High level language
IDENTIFIERS – Name given to a Variable
- Uses interpreter
Variable – used to store data
Python modes ? A = 5435, Russian = 6000
INTRODUCTION

- Interactive Naming Rules :-


- Script 1. Can start either with alphabet or underscore
2. Can’t use special symbols
print(“ ”) is used to show output 3. Keywords can’t be used

© Youth Af
Codes Used -

© Youth Af
Datatypes - Operators -
1. Numeric – ❑ Arithmetic : + - * / ** // %
❑ Int : 45, 69, 0, -1, -50 ❑ Comparison : > < <= >= == !=
❑ Float : 5.24, 2.356, 0.541 ❑ Logical : and or not
❑ Complex : 5 +4j, 36+2j ❑ Assignment : = += -= *= /= //= %=
❑ Boolean : 0, 1 ❑ Identity : is isnot
❑ Membership : in notin
2. Sequence –
❑ String : ‘Lana’, “Daniels”
❑ Tuple :
❑ List :
Comments -
3. Sets – No duplicate items
Comments are lines of code which are ignored
DATATYPES

4. None – unknown / missing value by python.


5. Dictionary – Key value Pairs Comments start with #

Used For explanation of our code.


© Youth Af
© Youth Af

Arithmetic Operators
+ Addition
- Subtraction
* Multiplication
/ Division
// Floor Division
% Modulus
** Exponent
Relational Operators
== Equals to
!= Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

© Youth Af
Assignment Operators = += -= *= /= //= %= **=

© Youth Af
Logical Operators and or not

© Youth Af
Identity Operators is is not

© Youth Af
Identity Operators
in not in

© Youth Af
Contents
1) Introduction
2) Selection
3) Indentation
4) Repetition
5) Break - Continue
6) Nested Loops

CONTENTS
© Youth Af

Introduction - What is Flow of Control ?


The order of execution of our code.
How to take user’s Input? It is implemented using Control Structures

Selection : if elif else


Repetition : for while

Selection -
Decision Making using - if elif else
For Numeric Data For 1 condition : if
For 2 conditions : if else
For more than 2 conditions : if elif else
INTRODUCTION

Indentation : Space we give for a condition


© Youth Af
Repetition - While Loop
We can execute a statements as long as a condition is true
for Loop

Iteration

Start end Break – Loop se bahar aane ke liye

Range( ) – (start stop step)

Continue – Skip krne ke liye


Repetition
Contents
1) Introduction
2) Indexing
3) String Operations
4) Built in Functions
5) Traversing Strings

CONTENTS
© Youth Af

Introduction - String Operations -


What is String ? ❑ Slicing: [start : end+1]
A string is a sequence of characters. ❑ Concatenation: +
Character: letter, digit, symbol or space ❑ Repetition: *
It is immutable in nature ❑ Membership : in, not in
It is enclosed within ’ ’ or “ ” or ’’’ ’’’
Built in functions ?
Indexing ? ❑ len()
Position of character ? ❑ lower()
❑ upper()
❑ islower()
❑ isupper()
INTRODUCTION

Traversing Strings?
For loop
While loop
Length : No of characters
© Youth Af
Contents
1) Introduction
2) Indexing
3) List Operations
4) Built in Functions
5) Traversing Lists

CONTENTS
© Youth Af

Introduction - List Operations -


What is a List ? ❑ Slicing: [start : end+1]
A Sequence datatype that can store multiple
❑ Concatenation: +
values.
❑ Repetition: *
It is enclosed within [ ].
❑ Membership : in, not in

Built in functions ?
Indexing ? ❑ len()
Position of value ? ❑ min()
❑ max()
❑ sum()
❑ remove()
INTRODUCTION

It is mutable in nature. Traversing Strings?


For loop
While loop
© Youth Af
© Youth Af

Dictionary - Operations ?
❑ Membership : in, not in
What is a Dictionary ?
Dictionaries store data in key : value pairs. Built in functions ?
It is enclosed within { } ❑ len()
❑ keys()
❑ values()
❑ items()
❑ clear()

No same keys allowed


It is mutable in nature.
DICTIONARY

Traversing ?
© Youth Af
© Youth Af

Dictionary - Operations ?
❑ Membership : in, not in
What is a Dictionary ?
Dictionaries store data in key : value pairs.
It is enclosed within { }
Built in functions ?
❑ len()
❑ keys()
❑ values()
❑ items()
❑ clear()
No same keys allowed
It is mutable in nature.

© Youth Af
THANK YOU

NOTES IN DESCRIPTION

You might also like