1,760
edits
Changes
→INVESTIGATION 1: USER INPUT
</source>
:# Before proceeding, make certain that you identify any and all errors in '''lab2a.py'''. When the check script tells you everything is '''OK''', you may procede to the next step.
:#The above Python script '''lab2a.py''' is not very useful - the data are '''hard wired''' into the script: it displays the same output regardless of the number of times that this Python script is run.<br>The built-in '''input()''' function can be used to accept data in '''string form''' from the user and assign a name to the string object (used to be called a variable). It is typical to place a question (or hint) as an argument in the input() function: this will aid the user in typing in the correct data.<br><br>
:#Copy lab2a.py to lab2a1.py and replace the print() call in lab2a1.py with the following (you can just comment-out the print() call using a '''#''' at the beginning of the line): <source lang="python">