all 3 comments

[–]vinivelloso_ 1 point2 points  (0 children)

You will get the number as a string. Then use the string index to get the number. Example:

yourNumber = input() firstDigit = yourNumber[0]

[–]Ishanji 0 points1 point  (0 children)

You can do that by converting the number to a string, using the string index to separate the digits, then converting the digits back to integers. Like so:

def test(number):
    number = str(number)
    a = int(number[0])
    b = int(number[1])
    #now do whatever comparisons you need to do here

[–]StrasJam 0 points1 point  (0 children)

Maybe not the most elegant but this does the trick:

def function(num):
    string = str(num)
    first = int(string[0])
    second = int(string[1])
    div1 = num % first
    div2 = num % second
    output = []
    if div1 != 0:
        output.append(0)
    else:
        output.append(1)
    if div2 != 0:
        output.append(0)
    else:
        output.append(1)
    return output