Identify and fix the errors in the following code:
1 # Display two messages
2 print("Welcome to Python")
3 print("Python is fun").
Here, identified the error as indentation.The statements are entered from the first column in the new line. The Python interpreter will report an error if the program is typed as follows:
# Display two messages
print("Welcome to Python")
print("Python is fun").
Don’t put any punctuation at the end of a statement.
print("Python is fun").
The error fixed code:
# Display two messages
print("Welcome to Python")
print("Python is fun")
Output:
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Welcome to Python
Python is fun
>>>