Leading white space at the beginning of the logical line is called indentation.
Indentation
•
Leading white space at the beginning of the logical line is called indentation.
•
Python programs get structured through indentation, i.e. code blocks are
defined by their indentation.
•
All statements with the same distance to the right belong to the same block of
code, i.e. the statements within a block line up vertically.
•
If a block has to be more deeply nested, it is simply indented further to the
right.
•
For example –
age
= int(input('How old are you? '))
if
age < = 2:
print(‘Infant’)
Here
the line is indented that means this statement will execute only if the if
statement is true

•
String is collection of characters.
• In python it is possible to perform
the concatenation and repetition operations on strings using the operators like
+ and *.
For
example
>>>str1="Hello"
>>>
str2="friend"
>>>
str1+str2 'Hellofriend'
>>>
"welcome"*2
'welcomewelcome'
Problem Solving and Python Programming: UNIT II: Data Types, Expressions, Statements : Tag: Engineering Python : Engineering Python Programming - Indentation, String Operations
Problem Solving and Python Programming
GE3151 1st Semester | 2021 Regulation | 1st Semester Common to all Dept 2021 Regulation