Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

123 bytes added, 12:30, 25 May 2017
PART 1 - USER INPUT
:#Try running this script inside ipython3 and study the output:<source>
run lab2a.py
</source>:#This Python script is not very useful, it also gives the same output everytime it runs. In ipython3 lets use <br><br>the '''input() ''' function to get information from the userand store it into a variable. 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>:#This Python script is not very useful: shows the same output every time that it is executed. Return to your '''ipython3''' shell, edit the lab2a.py file and add the following code: <source>
colour = input("Type in a colour and press enter: ")
Type in a colour and press enter: red
13,420
edits