3.3.6. User input#

We can create strings interactively from user input:

the_string = input()

This allows the user to type some text right in the console. It is usually a good idea to provide some text to the user:

the_string = input("Please enter your name: ")

Note that the input function always create a string. If you want the user to input a float, then you need to convert the string to a float:

height = float(input("What is the participant's height in meters? "))

Or if we need the user to enter an integer:

i_cycle = int(input("Which gait cycle do we keep? "))