Challenge:
Given two null-terminated strings in the arguments "string" and "prefix", determine if "string" starts with the "prefix" string. Return 1 (or any other "truthy" value) if true, 0 if false.

Example:
```
startsWith("hello world!", "hello"); // should return 1.
startsWith("hello world!", "HELLO"); // should return 0.
startsWith("nowai", "nowaisir"); // should return 0.
```

Addendum:
For this problem, an empty "prefix" string should always return 1 (true) for any value of "string".

If the length of the "prefix" string is greater than the length of the "string", return 0.

The check should be case-sensitive, i.e. startsWith("hello", "HE") should return 0, whereas startsWith("hello", "he") should return 1.

The length of the "string" as well as the "prefix" can be defined by the formula: 0 <= length < +Infinity

No characters should be ignored and/or omitted during the test, e.g. whitespace characters should not be ignored.

Difficulty: introductory

Starter code:

def starts_with(st, prefix):
	

Solutions:
starts_with = str.startswith

def starts_with(st, prefix): 
    return st.startswith(prefix)

def starts_with(st, prefix): 
    return 1 if st[:len(prefix)] == prefix else 0

def starts_with(st, prefix): 
    x = len(prefix)
    if len(prefix) > len(st):
        return False
    if st[:x] == prefix:
        return True
    return False
    
        
        
    


def starts_with(stg, prefix): 
    return stg.startswith(prefix)


# one-liner: starts_with = str.startswith


def starts_with(st, prefix): 
    if len(st)==0!=len(prefix):
        return False
    elif len(prefix)==0:
        return True
    else:
        try:
            a = 0
            for i in range(len(prefix)):
                if st[i]==prefix[i]:
                    a+=1
            if a==len(prefix):
                return True
            else:
                return False
        except:
            return False

def starts_with(s, prefix): 
    return s[:len(prefix)]==prefix

def starts_with(st, prefix): 
    if len(prefix) == 0:
        return True
    elif len(prefix) > len(st):
        return False
    else:
        return st.startswith(prefix)

def starts_with(st, prefix): 
    if st.startswith(prefix):
        return 1
    return 0    


def starts_with(st, prefix): 
    if not len(prefix) <= len(st): return False
    else: return st[:len(prefix)] == prefix