Skip to content

Commit

Permalink
Minor edit once again
Browse files Browse the repository at this point in the history
  • Loading branch information
davewhipp committed Oct 2, 2024
1 parent 5b24bd6 commit cbe0985
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/part1/chapter-02/nb/00-python-basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@
"tags": []
},
"source": [
"As you can see, `float()` converts a character string to a decimal value representing the number stored in the string. `float()` can be used to convert strings or integers to floating point numbers, however `float()` can only convert strings that represent numerical values. For example, `float(\"Cold\")` will raise a `ValueError` because `\"Cold\"` cannot be converted to a number directly. In our case, however, we can now easily calculate the difference between the forecast high temperature `forecastHigh` and `tempFahrenheit` as the data are now compatible."
"As you can see, `float()` converts a character string to a decimal value representing the number stored in the string. As a result, we can now easily calculate the difference between the forecast high temperature `forecastHigh` and `tempFahrenheit` as the data are now compatible."
]
},
{
Expand All @@ -1223,7 +1223,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Similar to `float()`, `str()` can convert numbers to character strings, and `int()` can be used to convert strings or floating point numbers to integers. For example, we could convert `tempFahrenheit` to an integer as follows."
"`float()` can be used to convert strings or integers to floating point numbers, however it is important to note that `float()` can only convert strings that represent numerical values. For example, `float(\"Cold\")` will raise a `ValueError` because `\"Cold\"` cannot be converted to a number directly. Similar to `float()`, `str()` can convert numbers to character strings, and `int()` can be used to convert strings or floating point numbers to integers. For example, we could convert `tempFahrenheit` to an integer as follows."
]
},
{
Expand Down

0 comments on commit cbe0985

Please sign in to comment.