Alfred H. - 1 year ago 76

Python Question

I am coding in Python and using Putty, I couldnt find the right way to do a program that does a modulus calculation without the mod function.

`def main()`

Input1 = int(input("Type in first number"))

Input2 = int(input("Type in second number"))

q = (input1 / Input2) #finding quotient (integer part only)

p = (q * Input2) //finding product

m = (Input1 - p) //finding modulus

print(Input1, "%", Input2, "=", m)

main

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

```
def main():
Input1 = int(input("Type in first number"))
Input2 = int(input("Type in second number"))
q = (Input1 / Input2)
for i in range(0, Input1, Input2):
if Input1 - i < Input2:
print(Input1-i)
```

This is a way to find what x mod y is in any given circumstance.