How do I turn a string into a number?

Asked by blessing007 · 6 months ago

1 Answer

25
amorebise · 6 months ago Top Answer

Sometimes a user types a number, but Python sees it as text (a string). We use int() to turn it into an integer or float() for decimals.

Think of it like translating a word into a value. You can't do math with the word "500", but you can with the number 500. This 'casting' is a vital skill.

Log in to add a comment.