Escape-Sequence

Wed 12 November 2025
#  created : 20250112
#  https://www.scientecheasy.com/2022/09/escape-sequence-in-python.html/
#  Escape Sequence in Python
#  error code for escape sequence 
print ('He said 'python is fun ultimated'')
  Cell In[3], line 1
    print ('He said 'python is fun ultimated'')
           ^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
print("he said 'python is fun ultimated'")
he said 'python is fun ultimated'
print('He said "Python is fun unlimited"')
He said "Python is fun unlimited"
print('He said \'Python is fun unlimited\'')
He said 'Python is fun unlimited'
print("Welcome to\tScientech Easy") # --> gives a tab between words
Welcome to  Scientech Easy
print("Good Morning \nScientech Easy")  #--> breaks one line into two lines 
print("*\n**\n***\n")
Good Morning 
Scientech Easy
*
**
***
print('Good Evening \\Scientech Easy\\') #--> prints the text with backslash
Good Evening \Scientech Easy\
print('Good Morning \rScientech Easy') # --> moves the output means it will not print the string before \r
Scientech Easy
emp_code = "IT-35264"
name = "Jerin"
desig = "Jr. Python Developer"
comp = "tact"
salary = "USD 40000"
print("Employee code: ", emp_code, "\nName: ", name)
print("Designation: ",desig, "\tCompany: ", comp)
print("Annual Salary: ", salary)
Employee code:  IT-35264 
Name:  Jerin
Designation:  Jr. Python Developer  Company:  tact
Annual Salary:  USD 40000


Score: 15

Category: python-basics