Keshia P. answered 04/03/19
Tutor
5.0
(215)
Experienced Design & Technology Professional, B.S. Computer Science
You can use Python's type function to determine a variable's type. See sample code below.
x=-3.222
if x<0:
sign = 'negative'
else:
sign = 'positive'
print(x, type(x), sign)
OUTPUT:
(-3.222, <class 'float'>, 'negative')