Unit-2
• Python Interpreter mode
• Python interactive mode
• Features
• Comment(#)
• Statements
–Print()
–Assignment =
Tokens/Programming Construct
• Keywords
• Literals
• Escape Sequence
• Delimiter
• values
• Identifier/variables
• Data type
• operator
keywords
• if, elif, while, for, break,
else, pass, True, False,
return, and, or, not
Literals
• Numeric:
– Digits(0-9)
– -/+
– Decimal point
– Int:25
– Float:25.6
• String:
• Sequence of character:
–‘hello’,
–“hello”
Escape sequence
• Non-printable character
• ‘/n’
• ‘/t’
Delimiter
• Symbols that perform 3 roles
– Grouping( ) ,[ ], { }
– Punctuation : ; . @
– Assignment +=,-=,*=
– Bitwise assignment&=,!=
Values
• Basic unit of data
• Int:2
• Float:67.9
• String:’hello’
Data type
• Int:
– +/-
– Range: -2,147,483,648 to +2,147,483,648
– Decimal(10): 27
– Octal(8):Oo27
– Hexadecimal(16):OX27
– Binary(0 or 1)
• Float:
–Decimal and fractional
–Scientific notation:
•+/-
•Mantissa
•Exponent
•Boolean:True /False
•None type:
• Complex
–Real and imaginary: z=7+6j
• String
• Sequence of character
• List: [ 11,12,13]
• Tuples:(11,12,13)
• Set:{ 11,1,2,3}
• Dictionary: {ab:12,ad:15}
Identifier/variables/data type
• Infosys

PROBLEM SOLVING AND PYTHON PROGRAMMING UNIT-2