Answers for "how to get the remainder of a number when dividing in python"

4

how to get the remainder in python

a = 10
b = 3

c = a % b
print(c) # Prints 1
Posted by: Guest on November-18-2019
2

how to calculate division with remainder in python

Modulo Operator (Python)
x % y

Example: 9 % 2 
9 ÷ 2 = 4 R 1
9 % 2 = 1
Posted by: Guest on October-25-2020
0

how to get the remainder of a number when dividing in python

def fractional_part(numerator,denominator):
	remainder = numerator%denominator
    if denominator == 0:
    	return 0 
    else: 
    	return remainder
Posted by: Guest on September-25-2021

Code answers related to "how to get the remainder of a number when dividing in python"

Python Answers by Framework

Browse Popular Code Answers by Language