Experimenting with print()

1 minute read

As a developer, you are encouraged to perform different experiments with the code and for that reasons, the experiment section answers will not be given here directly.

Let’s begin !

Experiment No - 01

# what will be the output ?
print("Amogh","Himanshi","Himanshu")

Experiment No - 02

# what will be the output ?
print("eduAlgo")
print("is")
print("Good")

Experiment No - 03

# what will be the output ?
print("eduAlgo",end=" ")
print("is",end=" ")
print("Good",end=" ")

Experiment No - 04

# what will be the output ?
print("eduAlgo",end="p")
print("is",end="l")
print("Good",end="a")

Experiment No - 05

# what will be the output ?
print("eduAlgo",end="p\n")
print("is",end="l\n")
print("Good",end="a\n")

PS - As you have witnessed above, the \n is the newline character that enables the printout in the newline. Whenever the compiler encounter the newline character the rest of the text just moves to a new line..

We are here to help ! Be sure to check our website and don’t hesitate to ask any questions on our community platform. We provide personal mentoring and teaching too, in order to upgrade your skills. Vist www.edualgoacademy.com to get started.

Spotted a bug ? Great job, you found a bug. Please report it to us in our mail and we’ll fix it as soon as possible.