Skip to main content

#mastery10 Basic output (print) in Python

1 min read

To show a message on python you have to use the print function which is probably the easiest, here's an example:

print ("Hello World") have to put "Hello World" between quotation marks because it is a string 

This will show the user:

Hello World

You can also print variables with this function, for example:

num= 1

print (num) quotation marks because num is a variable that contains a number

This will show the user:


BUT if you put num= helloworld this will show an error that says that helloworld is not defined because the program will take helloworld as another variable. If you want to add a string to a variable it must be between quotation marks like this:

num= "helloworld"

print (num)

This will show the user: