2. STRINGS
• A string is a data type that is used to represent a sequence of characters.
Such as numbers, text, spaces, punctuation, user name, communication with users, a
whole sentence or paragraph of data. Strings must be enclosed in quotation to
distinguish from variable names.
3. BASICS OF WORKING WITH
STRINGS
• Indexing
Each character in a string has an index
number, with the first character at
position 0. You can use the index to
reference individual characters in a string.
• Length
Length function : To find the number of
characters In a String
• Traversal
To cycle through each character of a
string. Mainly using Loops
4. MORE STRING MANIPULATION
• Finding Characters
with a certain Index
The index of a character is the position of
that character within a string. Which can be
accessed using square brackets.
• Changing Casings of
Characters
• Extracting Characters
By selecting characters from indexes 3 to
6, It leaves out the rest. Printing “put”
• Checking
Characters
‘put’ and ‘PUT’: ‘put’ is a substring of
‘Computer Science’ but ‘PUT’ is
not, so these examples will display ‘True’
then ‘False’.
5. DATA STRUCTURES
• A data structure is
an organized
collection of
related elements.
There are many
different data
structures that can
store multiple data
items used in
programming.
6. ARRAYS
• An array is an organized
collection of related values with
a single shared identifier. All
the elements in an array are the
same data type, where each has
a unique index value denoting
its position in the array.
• One/ Single dimension array
where the data are stored in the
sequential order. For example, it
can be used to store name or
mobile number or grade
• A multidimensional array is an ‘array of arrays’; where
each item at an index is another array
7. LISTS
• Lists are easier to use as they are dynamic – they do not have a fixed size and can grow as new
elements are added. When they are declared they do not have to be given a size and can grow as
new elements are added.
• In Python, arrays are not
commonly used. Instead lists are
used but they are very similar in
the way that they operate. Just
like an array, a list is created by
adding items, separated by
commas, inside square brackets
10. VARIABLE INITIALIZATION & DATA
TYPES
• When algorithms are
converted into programs, the
computer needs to be told
what type of data is stored in
each variable. Every
programming language has a
number of built-in data
types.
• When a variable is declared, the computer gives it a location in its
memory. Initially, this location is empty, so before a variable can
be used it has to be given a value.
11. SEQUENCE : SELECTION : ITERATION
• There are three key building blocks of algorithms : They are command sequence, selection
and iteration.
12. • Sequence
• The order in which
instructions occur
and are processed
• Selection
• Making decisions
by asking a
question &
depending on the
outcome, follow
one of the two
paths or take
certain actions &
ignore others
13. SELECTING WITH IF STATEMENTS:
• The IF statement is a decision-
making statement that guides
a program to make decisions
based on specified criteria
• The Nested if statement allows
you to create a chain of if
statements. The if statements
are evaluated in order until one
of the if expressions is true or
the end of the if chain is
reached. If the end of the chain
is reached without a true
expression no code blocks are
executed.
14. ITERATION (LOOPS) :
• Indefinite Loop : A loop where it
is not easy to know amount of
execution required.
• Definite Loops : A loop that
executes a known number of times.
This type of loop can be executed
using while statements
This type of loop can be executed
using for statements
Nested for Loop : The inner loop
will finish all of it’s iterations before
finishing one iteration of the ‘ outer
loop’