Open coded92 opened 6 years ago
mystery_int_1 = int() mystery_int_2 = int()
mystery_int_1 = input("Enter a Number:") mystery_int_2 = input("Enter another Number:")
if mystery_int_1 % mystery_int_2 == 0 or mystery_int_2 % mystery_int_1 ==0: print("Factors!") else: print(" ")
mystery_int_1 = int( input("Enter a Number: "))
mystery_int_2 = int(input("Enter another Number: "))
if mystery_int_1 or mystery_int_2 == 0:
print("Factors!")
elif mystery_int_1 % mystery_int_2 == 0 or mystery_int_2 % mystery_int_1 ==0:
print("Factors!")
else:
print(" ")
In this the variables are assigned the value which you have given and hence the code:
mystery_int_1, mystery_int_2 = 7, 2 print("Factors!" if mystery_int_1%mystery_int_2 ==0 or mystery_int_2%mystery_int_1==0 else " ")
But if the user wants to enter the number then the code would be :
mystery_int_1, mystery_int_2 = int( input("")), int(input("")) print("Factors!" if mystery_int_1%mystery_int_2 ==0 or mystery_int_2%mystery_int_1==0 else " ")
Please can you help solve this in Python and explain to me
mystery_int_1 = 7 mystery_int_2 = 2
You may modify the lines of code above, but don't move them! When you Submit your code, we'll change these lines to assign different values to the variables.
The variables below hold two integers, mystery_int_1 and mystery_int_2. Complete this program below such that it prints "Factors!" if either of the numbers is a factor of the other. If neither number is a factor of the other, do not print anything.
Hint: You can do this with just one conditional statement by using the logical expressions (and, or, and not). You'll also use the modulus operator
Please help me with the Add your code here!
Have tried several means am just not getting it