float division in python code example

Example 1: integer division python

#normal division
5 / 4
#1.25

#integer division
5 // 4
#1

Example 2: python divison //

# "normal" division in python
print(5/2)			# 2
print(-5/2)			# -3
print(5.0/2)		# 2.5
print(-5.0/2)		# -2.5

# floor division in python
print(5//2)			# 2
print(-5//2)		# -3
print(5.0//2)		# 2.0
print(-5.0//2)		# -3.0

Example 3: float division in python

print("Please input a number.")
num1 = float(input())
print("Please input another number.")
num2 = float(input())
print (num1,"/",num2,"=",num1/num2)