Robotics & Artificial Intelligence

What would be the output of following program?

print("Hello\nWorld!") 
print("Python\tProgramming") 

Python String Manipulation

1 Like

Answer

Output
Hello
World!
Python    Programming
Explanation

In the given program, the print() function is used to display output on the screen and escape sequences are used inside strings. The escape sequence \n is used to insert a new line in a string, so after printing Hello, the cursor moves to the next line and World! is printed. The escape sequence \t is used to provide space for one tab, therefore a tab space appears between Python and Programming when it is printed.

Answered By

1 Like


Related Questions