Type conversion functionsΒΆ




(ch02_20)

The last case shows that a string has to be a syntactically legal number, otherwise you’ll get one of those pesky runtime errors.

The type converter float can turn an integer, a float, or a syntactically legal string into a float.




(ch02_21)

The type converter str turns its argument into a string. Remember that when we print a string, the quotes are removed. However, if we print the type, we can see that it is definitely str.




(ch02_22)

Next Section - Variables