### Input and style¶

input(prompt) returns (i.e.) has the value of what's entered with a keyboard input() returns a string. That means that if we want to read in an integer, we should use int(input(prompt)).

Here are three variants of the same thing:

In [1]:
#Best style: human-readable, no excessive brevity.
my_input = input('Give me an integer: ')

Give me an integer: 123

In [2]:
#Too many variables that aren't doing much: not as readable.
my_input_str = input('Give me an integer: ')
my_input_int = 2*int(my_input_str)
output_str = 'Your input twice:' + str(my_input_int)
print(output_str)

Give me an integer: 321

#Too brief, perhaps not as readable. The kind of thing that you would see if

Give me an integer: 231