Create a Python function to calculate the sum of all numbers from 0 to the input number.
5
def sum_to(num):
    sum = 0
    for i in range(num+1):
        sum += i
    return sum
 
num = 5
print(sum_to(num))   # 15