# Summary:
Given a number, `num`, return the shortest amount of `steps` it would take from 1, to land exactly on that number.

# Description:
A `step` is defined as either:
- Adding 1 to the number: `num += 1`
- Doubling the number: `num *= 2`

You will always start from the number `1` and you will have to return the shortest count of steps it would take to land exactly on that number.

`1 <= num <= 10000`

Examples:

`num == 3` would return `2` steps:

```
1 -- +1 --> 2:        1 step
2 -- +1 --> 3:        2 steps

2 steps
```

`num == 12` would return `4` steps:

```
1 -- +1 --> 2:        1 step
2 -- +1 --> 3:        2 steps
3 -- x2 --> 6:        3 steps
6 -- x2 --> 12:       4 steps

4 steps
```

`num == 16` would return `4` steps:

```
1 -- +1 --> 2:        1 step
2 -- x2 --> 4:        2 steps
4 -- x2 --> 8:        3 steps
8 -- x2 --> 16:       4 steps

4 steps
```

Difficulty: introductory

Starter code:

def shortest_steps_to_num(num):
	

Solutions:
def shortest_steps_to_num(num):
    steps = 0
    
    while num != 1:
        if num % 2:
            num -= 1
        else:
            num //= 2
        
        steps += 1
    
    return steps

def shortest_steps_to_num(num):
    return num.bit_length() + bin(num).count('1') - 2

def shortest_steps_to_num(num):
    x=0
    while num>1:
        if num%2: num-=1
        else: num/=2
        x+=1
    return x


def shortest_steps_to_num(n):
    return bin(n).count('1') + n.bit_length() - 2    

def shortest_steps_to_num(num):
    return 0 if num == 1 else 1 + shortest_steps_to_num(num - 1 if num % 2 else num / 2)


def shortest_steps_to_num(n):
    return (
        0 if n == 1 else
        1 + shortest_steps_to_num(n-1) if n % 2 else
        1 + shortest_steps_to_num(n//2)
    )

def shortest_steps_to_num(n):
    step = 0
    while n > 1:
        n, step = n // 2, step + 1 + n % 2
    return step

def shortest_steps_to_num(num):
    s = bin(num)
    return len(s) + s.count('1') - 4

def shortest_steps_to_num(num):
    steps = 0
    while num > 1:
        if num % 2 == 0:
            num = num // 2
        elif num == 3:
            num -= 1
        else:
            num -= 1
        steps += 1
    return steps


def shortest_steps_to_num(num):
    a= str(bin(num))[3:]
    return len(a)+a.count('1')