DEV Community

Cover image for Taking user input in python
Ezeana Micheal
Ezeana Micheal

Posted on • Edited on

Taking user input in python

Taking user input
In python, to request input from the user you use the "input()" statement
The input value can then be assigned and used in the program I.e
Code

Result

When requesting input from the user you can print a statement telling the user the required format an input is required in
This is done by typing
Code

Result

You can also request integers by using the int() statement
So it'll be like this
Code

Result

With this, we can then make our first program as written in the last session more flexible by writing.
Code

Result

Hope you enjoyed this lesson Read, like, share, comment and see you later next week.

Top comments (0)