DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,503 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
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.

Latest comments (0)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.