20. Predict the output of following:
x, y=7,2
x, y, X = X+1, y + 3, X + 10
print (x, y)
Answers
Answer:
Python is known for its simplicity. So, let's tell the computer to say hello to us. (Assuming that you have gone through the Introduction chapter first and know how to write and compile Python codes. If not, then first go through the Introduction chapter.)
Python 2 Python 3
print("Hello World")
Output
Hello World
And that's it!
To print any message on screen, just type print() and that message in (' ') or (" "). Isn't it simple?.
'print' is a function which prints something on the screen. (You will learn about functions in detail in later sections)
In Python 2, 'print' is not a function, it is a statement. You will understand about functions in later chapters.
Answer:
Python is known for its simplicity. So, let's tell the computer to say hello to us. (Assuming that you have gone through the Introduction chapter first and know how to write and compile Python codes. If not, then first go through the Introduction chapter.)
Python 2 Python 3
print("Hello World")
Output
Hello World
And that's it!
To print any message on screen, just type print() and that message in (' ') or (" "). Isn't it simple?.
'print' is a function which prints something on the screen. (You will learn about functions in detail in later sections)
In Python 2, 'print' is not a function, it is a statement. You will understand about functions in later chapters.
Explanation: