Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

python division operator

  • The division operator in python is used to perform the division operations.
  • It divides the left-side values with the right-side value and gives the remainder.
  • In other languages, we have only one division operator but in python, we have 2 division operators.
  1. division.
  2. floor division.
 1.Division: In division when we divide values we get the result in floating type.
It is denoted by the symbol "/".
 syntax:(x/y).

Example: write a python code for integers using a division operator.

  1. x=20
  2. y=4
  3. print(x/y)
output:5.0



It is denoted by the symbol "//".
syntax:(x//y).

Example: write a python program for integer values using floor division.

  1. x=20
  2. y=4
  3. print(x//y)
output: 5

















This post first appeared on Java Tutorial - InstanceOfJava, please read the originial post: here

Share the post

python division operator

×

Subscribe to Java Tutorial - Instanceofjava

Get updates delivered right to your inbox!

Thank you for your subscription

×