Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

129 bytes added, 12:42, 25 May 2017
PART 1 - User Input
''' Practice Storing User Input '''
:Now it's time to create a new script to prompt the user to enter data and display that data on their terminal. Refer to variable name and prompt text information when creating your Python script. Refer to Sample Runs displayed below for exact prompt and output requirements.
:'''Perform the following Instructions:'''
:# Make a copy of '''lab2a.py''' and call it '''lab2b.py'''.
:# Modify '''lab2b.py''' so that it prompts the user for both the user's '''name''' and '''age'''. Use the '''input()''' function and store the values in the correct variable names (displayed below). You can refer to Sample Runs displayed further below for reference.
::'''Input / Output Requirements''' :::*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 correctly spelled variables(case sensitivity counts):::*The script should print the EXACT OUTPUT as shown(case sensitivity counts) :::'''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
13,420
edits