top of page

Programming with Python Input and output

Python Input and output

The input function in Python takes a line of input from the user.

Output in Python is not directly a function. Outputting just uses the 'print' function in Python.

If the user has been asked for their name, using the print function (covered in the last blog):

print ("What is your name: ")

The user will then input their name.

The result of their input, ie. their name, can be assigned to a variable. We can call the variable 'name'.

name = input()

To print their name back to the screen, we can print the variable name.

print (name)

This simply prints their name back to them. We can make this more interesting by printing a short message with it. Try and guess what this does:

print ("Hello " + name)

This would print "Hello' to the user, followed by the name that they input into the program.

A '+' can be used in print functions to join different items being printed.

Try and have a play around with similar things to this that you can do.

Thanks ☺️


Recent Posts

See All


Commenting has been turned off.
bottom of page