03 - Getting User Input
One of the most important parts of programming is user interaction. There are many ways in which programs and applications interact with their users. For example, a game will allow a user to press certain buttons, or you can create an account on a websiteβ¦
And these are all forms of βuser-inputβ.
The Input Function
The input function allows for the user to type in text, and it captures that text and returns it to you as a string.
Two ways to use the input function - with an argument or without an argument
Calling the input function with an argument
If you call the input function with an argument, the argument must be a string.
The argument serves as a prompt for the user.
Calling the input function without an argument
If you choose to call the input function without an argument, itβs helpful to include a print statement beforehand, so that the user knows what theyβre expected to type.