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

Python modulo operator

  • Modulo operator:  The modulo is defined as "the remainder of the two arguments ".
  • It is denoted by the symbol   "%".
  • When we divide any number with 0 i.e;    x%0 the result is zero division error.
  • We can use int, float, and double values also.
  • Those int, float, double may be either positive or negative.
syntax:(x%y)
x is the first argument and y is the second argument.

#1.write a python program using the modulo operator.

  1. x=10.0
  2. y=2.0
  3. print(x%y)
output: 0.0


#2.write a Python Program for a value divides with 0 using the modulo operator.



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

Share the post

Python modulo operator

×

Subscribe to Java Tutorial - Instanceofjava

Get updates delivered right to your inbox!

Thank you for your subscription

×