Oct-05-2023, 08:41 PM
x will always be a string.
you can convert to whatever is needed.
Example:
you can convert to whatever is needed.
Example:
orig = input("enter a float") print(f"orig: {orig}, type orig: {type(orig)}") afloat = float(orig) print(f"afloat: {afloat}, type afloat: {type(afloat)}")
Output:enter a float: 123.45
orig: 123.45, type orig: <class 'str'>
afloat: 123.45, type afloat: <class 'float'>