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
With this, we can then make our first program as written in the last session more flexible by writing.
Code
Hope you enjoyed this lesson Read, like, share, comment and see you later next week.
Top comments (0)