DEV Community

Cover image for Taking user input in python
EzeanaMichael
EzeanaMichael

Posted on • Edited on

3 1

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.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay