INF110-Projects/Week-5/03_naming_errors.ipynb
cdez 140ffc6523 Remove the IPYNB Checkpoints, Did Week 5 HW
-- IPYNB Checkpoints
++ Git Ignore File for IPYNB Checkpoints
+- Week 5 Homework Files
2022-09-28 21:30:48 -07:00

79 lines
1.9 KiB
Text

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Errors in Naming"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Question 1.** When you run the following cell, Python will produce an slightly-cryptic error message. Explain in the text cell below, in your own words, what's wrong with the code. (Remember, double-click the cell to edit it, and then click the Run button when you're done.)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"4 = 2 + 2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Write your answer here, replacing this text.*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Question 2.** When you run the following cell, Python will produce an slightly-cryptic error message. **Fix the error,** and then **explain below** in your own words what was wrong with the code."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"two = 2\n",
"four = two + two"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Python didn't recognize the value called 'plus' and was probably confused about it being there, and since 'plus' is a mathmatical operation, I replaced 'plus' with '+' which when ran, gave no errors."
]
}
],
"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.12"
}
},
"nbformat": 4,
"nbformat_minor": 1
}