Printing messages and execution results on the screen makes an application more informative and user friendly. Further, it makes the application dynamic since it can display results which are generated on the fly.
Python provides a built-in method print which takes a string as an argument and prints it on the screen or console. If there are any variables supplied to this method or there are any variables with in the string provided, then these variables are evaluated before the output is displayed on the screen. This is how, the application will become more dynamic.
A perfect example would be reading two numbers from the user and display their sum.

Displaying different types together

first_number = 10
second_number = 20
sum = first_number + second_number
print('Sum is ' + sum)

Above code will not execute as expected but will throw an error at the print statement¬†TypeError: can only concatenate str (not “int”) to str.

0

This Post Has 2 Comments

  1. Am interested to know more about python

    1. This course covers details about basic python. Further there is an advanced topics section too.
      Still if you want to learn any other topic, do mention it here and we will try to add it.

Share your thoughts !!

Close Menu

Never Miss an article !

Get the new post delivered straight into your inbox, enter your email and hit the button

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

codippa will use the information you provide on this form to be in touch with you and to provide updates and marketing.