Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

31 bytes added, 02:25, 25 May 2017
PART 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.
:#Now it's time to create a new script. Make a copy of '''lab2a.py''' and call it '''lab2b.py'''. Now modify '''lab2b.py''' so that it asks the user for both the value of name and the value of age. Use the input() function and store the values in the correct variables. Example output is shown below:
::::*The script should have a Shebang line::::*The script should use a variable called "name"::::*The script should use a variable called "age"::::*The script should prompt the user for "Name: "::::*The script should prompt the user for "Age: "::::*The script should store the values in the correct variables::::*The script should print the EXACT OUTPUT as shown=== Practice - Storing User Input ===
Sample run 1:Now it's time to create a new script. Make a copy of '''lab2a.py''' and call it '''lab2b.py'''. Now modify '''lab2b.py''' so that it asks the user for both the value of name and the value of age. Use the input() function and store the values in the correct variables. Example output is shown below:
::*The script should have a Shebang line::*The script should use a variable called "name"::*The script should use a variable called "age"::*The script should prompt the user for "Name: "::*The script should prompt the user for "Age: "::*The script should store the values in the correct variables::*The script should print the EXACT OUTPUT as shown:::Sample run 1:<source>
run lab2b.py
Name: Jon
Hi Jon, you are 20 years old.
</source>
 :::Sample run 2: <source>
run lab2b.py
Name: Jen
Hi Jen, you are 25 years old.
</source>
  ::8. Download the check script and check your work. Enter the following commands from the bash shell.<source>
cd ~/ops435/lab2/
pwd #confirm that you are in the right directory
python3 ./CheckLab2.py -f -v lab2b
</source>
 ::9. Before proceeding, make certain that you identify any and all errors in "lab2b.py". When the check script tells you everything is "ok", you may procede to the next step.
== PART 2 - ARGUMENTS ==
198
edits