Professional Documents
Culture Documents
◻ Literals in Python
◻ Build-in format() Function
◻ Escape Sequences
◻ String Formatting Function
◻ Comments and Constants in Python
◻ Variables in Python
◻ Identifier in Python
◻ Built-in Data Types
◻ Python Indentation
◻ Reserved Keywords in Python
◻ Operators in Python
Literals in Python
❑ Literal: Literal is a raw data given in a variable or
constant. In Python, there are various types of
literals they are as follows:
Numeric Literals:
◻Using Triple quotes : we can specify multi-line strings using triple quotes.
◻Example
‘ ‘ ‘ good morning everyone.
Welcome to python
Programming language. ‘ ‘ ‘
String literals
word = 'word‘
sentence = "This is a sentence."
paragraph = """This is a paragraph. It is made up of multiple lines and sentences.""“
Print (word)
Print (sentence)
Print (pargraph)
◻ For Example:
Example:
print("boy replies,\"my name is Vijay\"")
boy replies,"my name is Vijay"
String Formatting Function
◻ This function can be used to control the display of
strings.
Syntax: format(value, format_specifier)
◻ Value -> value or string to be displayed
◻ format_specifier -> formatting options
Example:
format('Hello', '<30')
'Hello '
Example:
format('Hello', '>30')
' Hello'
Comments and Constants in Python
❑ Creating a Comment
Comments starts with a #, and python will ignore them:
Example :
# this is a comment
print(“Hello”)
Example:
if 5 > 2:
print("Five is greater than two!")
Note: Python will give you an error if you skip the indentation.
Reserved Keywords in Python
https://www.tutorialspoint.com/python/python_variable_types
.htm