Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

16 bytes removed, 10:37, 22 January 2018
PART 1 - User Input
print('Hi ' + name + ', you are ' + str(age) + ' years old.')
</source>
:#Try running this script inside ipython3 and study the output:<source>
./lab2a.py
</source>This Python script is not very useful: it displays the same output regardless of the number of times that the Python script is run.<br>The '''input()''' function is used to obtain information from the user and store it into a variable. It is typical to place a question (or hint) as a argument in the input() function: this will aid the user in typing in the correct information.<br><br>