Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Numbers
#1
There are three types of numerics in Python

int = Integers
float = decimals
complex = special


Code:
a = 3    # int
b = 2.7  # float
c = 3j   # complex


In order to verify the type of an object in Python we should use the type() function

print(type(a))
print(type(b))
print(type©)

You declare the three variables then print their type
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)