DEV Community

Cover image for Taking user input in python
EzeanaMichael
EzeanaMichael

Posted on • Updated 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
Image description
Result

Image description

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
Image description

Result

Image description

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

Result
Image description

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

Result
Image description

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

Top comments (0)