Read Python Interview Questions and Answers for Beginners and Experienced

Python number example

In the Python tutorial series, we will study about Python Number. In Python String concatenation we study how we can concatenate two strings in Python.

Here we will study about Python number with example. In Python number values like integer value or decimal values are directly assign to some variable. There is no need to put any type before creating any variable.

In Python, anything we can display using print() function. Here we will see Python number example.

#Python number Example

num1=10
num2=12.25

print(type(num1))
print(type(num2))

print(num1)
print(num2)

 

<class 'int'>
<class 'float'>
10
12.25

 

Explanation

  • Here num1 and num2 are two numbers.
  • num1 is integer number and num2 is decimal number.
  • we can check their type by using type function of Python.
  • we can print numbers using print function.