# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import numpy as np


# +
#Python code

def python_fib(n):
    a, b = 0.0, 1.0

    for i in range(n):
        tmp = a
        a += b
        b = tmp
    return a

# %timeit python_fib(2000000000)


# -

# %load_ext cython

# + language="cython"
#
# #Cypthon code
#
# def cython_fib(int n):
#     cdef double a = 0.0
#     cdef double b = 1.0
#     cdef double tmp
#     for i in range(n):
#         tmp = a
#         a = a + b
#         b = tmp
#     return a
#
# -

# %timeit cython_fib(2000000000)

# + language="cython"
#
# cdef float a = 129  #in seconds
# cdef float b = 1.67        
#
# #how much faster is cypthon?
#
# cdef float c = a // b
#
# print(f'Cypthon is {c} times faster than python')
# -

print('Cypthon is fast')







# +
def say_hello ():
    print('Hello World')
    
# %timeit say_hello   
# -



StarcoderdataJupyterScriptsDedupFiltered