DEV Community

Dr. Azad Rasul
Dr. Azad Rasul

Posted on

2- Using the Print() Function

Are you ready to take your Python skills to the next level? Look no further than the Python console and the powerful print() function. With this guide, you'll learn how to use print() to write and display text, variables, and even complex data structures. Say goodbye to guessing what your code is doing and hello to mastering the Python console.

In the Python console use print() function to write.

print("Hello My Dear Learner!")
Enter fullscreen mode Exit fullscreen mode

Then click "Enter"

Hello My Dear Learner.png

print("My name is 'Your Name'. ")
Enter fullscreen mode Exit fullscreen mode

You can print the output of mathematical operations, for example:

print (120/6)
# 20.0
Enter fullscreen mode Exit fullscreen mode
print ("20 * 6 = ", 20*6)
# 20 * 6 =  120
Enter fullscreen mode Exit fullscreen mode
x = 10
print(x)
# 10
Enter fullscreen mode Exit fullscreen mode
>>> x = 10
>>> y = 20
>>> z = x + y
>>> print ("x + y = ", z)
# x + y = 30
Enter fullscreen mode Exit fullscreen mode

In conclusion, the article provides a comprehensive guide on how to use the print() function in the Python console to write and display text, variables, and even complex data structures. By mastering the print() function, readers can improve their Python skills and have a better understanding of what their code is doing.

If you like the content, please SUBSCRIBE to my channel for the future content

Top comments (0)