Taking
User Input
In Python
Ali Moustafa
@ali-moustafa2000
Inputting One Value
In Python, you can use the "input()" function to
accept user input.
Here's an example of how to take input for one
value:
@ali-moustafa2000
Inputting Multiple Values
You can also take input for multiple values in
Python Using the "split()" method.
This method helps in getting multiple inputs from
users. It breaks the given input by the specified
separator.
If a separator is not provided then any white space
is a separator.
@ali-moustafa2000
Inputting Multiple Values
Example If a separator is "not provided"
@ali-moustafa2000
Inputting Multiple Values
Example If a separator is "provided"
Output will be priented in a list so If you want to
unpack the list of numbers and use them as
separate variables, you can use the "*" operator.
For example:
@ali-moustafa2000
Inputting Multiple Values
Using "*" to unpack the list
@ali-moustafa2000