lundi 16 août 2021

How to check if number can be divided by two numbers

I need to make small program that checks if number is divisible by two numbers at same time, if not it will not output anything.

Example 6 is true but 3 is false.

I tried this, but in sometimes it outputs even its not.

number = int(input("Give number: "))
if number % 2 and number % 3:
    print("True")

Aucun commentaire:

Enregistrer un commentaire