So i made this code to check if to integers can be devided without a rest, and its working. But I needed to make a change so it works. I really just want to understand why this little change completely inversed the outcome of my code. This is the working code
x = input("Erster Teiler")
y = input("Zweiter Teiler")
z = int(x)%int(y)
z1 =int(y)%int(x)
if z == 0 or z1 == 0:
print("teilbar")
else:
print("nicht teilbar")
my first attempt at this excercie is doing the exact oppossite. If i put in 2 numbers that you can not divide, it says they are divisable. I just want to know what makes the difference in these codes. As you can see all i did was changing the premise for my first if-condition.
x = input("Erster Teiler")
y = input("Zweiter Teiler")
z = int(x)%int(y)
z1 =int(y)%int(x)
if z or z1 == 0:
print("teilbar")
else:
print("nicht teilbar")
Aucun commentaire:
Enregistrer un commentaire