0% found this document useful (0 votes)
13 views

Getting Started With Python

Uploaded by

Mohid Mobin
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Getting Started With Python

Uploaded by

Mohid Mobin
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Getting Started with

Python
Learning Objective

To be able to
 Explain different types of Literals
 Predict size of the string
Literals
 Literals(oftenreferred to as constant-Values) are data
items that have a fixed value.
String Literals
 String Literal is a collection of character(s) enclosed in a
double or single quotes.

 In Python both single character or multiple characters


enclosed in quotes such as 'hello',"hello",'+',"*" are treated as
same.

 Nongraphic characters are those characters that cannot be


typed directly from keyboard. e.g., backspace, tabs,
carriage return etc. Can be represented by using escape
sequences.

 An escape sequence is represented by backslash(\) followed


by one or more characters.
Escape Sequences
Size of the String
Size of the String
 For multiline strings created with triple quotes, while
calculating size, the EOL (end-of-line) character at the end
of the line is also counted in the size.

 Backslash at the end of string will not be counted while


calculating the size.
Numeric Literals
Numeric Literals
Numeric Literals
Boolean Literals

Special Literal None


Points to remember

 You can check the type of the literal using type() function

Numeric values with commas are not


considered as int or float value, rather
Python treats them as tuple.
AFL
Plenary

I can………

You might also like