Alfred H. - 3 months ago 15

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

Answer

```
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.