San Jose State University Department of Applied Data Science
**DATA 200 Computational Programming for Data Analytics**
Spring 2023 Instructor: Ron Mak
**Flash Quiz** February 22, 2023
You have 10 minutes. Maximum 20 points
"
]
},
{
"cell_type": "markdown",
"id": "9e474b84-79e1-4cb9-b792-673a03607e5c",
"metadata": {},
"source": [
"#### **PROBLEM 1:** [10 points] Define a Python function that has two parameters which you may assume will have floating-point values. Calculate (a) the smaller of the two parameter values, (b) the larger of the two values, and (c) their average. Return these three calculated values.\n",
"#### Do not use any of Python's built-in functions in your function."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "160fe05c-3b6e-4876-86bf-0d0f190affca",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "714570b5-e8ce-45e2-9599-ce3a67433f5d",
"metadata": {},
"source": [
"#### **PROBLEM 2:** [10 points] Write Python code that (a) prompts the user for two numeric values, (b) calls your function from Problem 1 passing the two values as floating-point values and (c) prints the returned three values in a line similar to:\n",
"\n",
"`The average of 3.6 and 12.4 is 8.00`\n",
"\n",
"#### No matter what order the user entered their values, you should print the smaller value first. Print the average with two decimal places."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "68cb0030-4d40-4a56-952a-5d3735864345",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}