is there use for, instead of int('11'), something like int('hello world')?
to put it in simpler terms is there or would there...or is it even possible to pass a string with words? example like in the question int('hello world') or float('hello world')
i know i might be thinking too much into it but im reviewing the course and dotting my i crossing my t's sort of speak.
please, and thank you
Jennifer NordellTreehouse Moderator
Hi there! If you try and pass in a string that can not be converted to a number such as "hello" you will get back a
ValueError. This differs slightly from
TypeError. For example, the
int function can take either a string or a number. But not all strings can be converted to an integer. The string "42" can be converted to an integer, but the string "my dog" can not. This is when we get a
ValueError, the type of the data you're sending in (string) is supported, but the value is such that the task still cannot be completed. However, if you were to send in a list, then you would receive a
TypeError as it is neither a string, nor a number.
Hope this helps!